aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-07-12 15:56:40 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-07-12 15:56:40 -0400
commitdab5003d6bba57c27f4111653b36d39862b5b6fd (patch)
treebdf7462c3718eb729f71b1245c3f651b016e8412 /MediaBrowser.Controller
parent3370fb072e71ad93c540d50d859d6cbe85552735 (diff)
added collection type
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Dto/DtoBuilder.cs13
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs20
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs10
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs4
-rw-r--r--MediaBrowser.Controller/IO/FileData.cs15
-rw-r--r--MediaBrowser.Controller/Library/ILibraryManager.cs7
6 files changed, 55 insertions, 14 deletions
diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs
index 7167447e40..85484d161d 100644
--- a/MediaBrowser.Controller/Dto/DtoBuilder.cs
+++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs
@@ -548,6 +548,19 @@ namespace MediaBrowser.Controller.Dto
{
SetGameProperties(dto, game);
}
+
+ var musicVideo = item as MusicVideo;
+
+ if (musicVideo != null)
+ {
+ SetMusicVideoProperties(dto, musicVideo);
+ }
+ }
+
+ private void SetMusicVideoProperties(BaseItemDto dto, MusicVideo item)
+ {
+ dto.Album = item.Album;
+ dto.Artists = string.IsNullOrEmpty(item.Artist) ? new string[] { } : new[] { item.Artist };
}
private void SetGameProperties(BaseItemDto dto, Game item)
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 1547653256..c89a7f0b2a 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -336,7 +336,7 @@ namespace MediaBrowser.Controller.Entities
// When resolving the root, we need it's grandchildren (children of user views)
var flattenFolderDepth = isPhysicalRoot ? 2 : 0;
- args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, flattenFolderDepth: flattenFolderDepth, args: args, resolveShortcuts: isPhysicalRoot || args.IsVf);
+ args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf);
// Need to remove subpaths that may have been resolved from shortcuts
// Example: if \\server\movies exists, then strip out \\server\movies\action
@@ -1111,6 +1111,24 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentNullException();
}
+ // Normalize
+ if (string.Equals(person.Role, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
+ {
+ person.Type = PersonType.GuestStar;
+ }
+ else if (string.Equals(person.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
+ {
+ person.Type = PersonType.Director;
+ }
+ else if (string.Equals(person.Role, PersonType.Producer, StringComparison.OrdinalIgnoreCase))
+ {
+ person.Type = PersonType.Producer;
+ }
+ else if (string.Equals(person.Role, PersonType.Writer, StringComparison.OrdinalIgnoreCase))
+ {
+ person.Type = PersonType.Writer;
+ }
+
// If the type is GuestStar and there's already an Actor entry, then update it to avoid dupes
if (string.Equals(person.Type, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
{
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index fa285a85f7..507b6df8a8 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -1,4 +1,5 @@
-using System;
+using MediaBrowser.Controller.Library;
+using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
@@ -6,7 +7,6 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Controller.Library;
namespace MediaBrowser.Controller.Entities
{
@@ -29,6 +29,8 @@ namespace MediaBrowser.Controller.Entities
}
}
+ public string CollectionType { get; set; }
+
/// <summary>
/// Allow different display preferences for each collection folder
/// </summary>
@@ -69,7 +71,7 @@ namespace MediaBrowser.Controller.Entities
/// Our children are actually just references to the ones in the physical root...
/// </summary>
/// <value>The actual children.</value>
- protected override ConcurrentDictionary<Guid,BaseItem> ActualChildren
+ protected override ConcurrentDictionary<Guid, BaseItem> ActualChildren
{
get
{
@@ -91,7 +93,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
.SelectMany(c => c.Children);
- return new ConcurrentDictionary<Guid,BaseItem>(ourChildren.ToDictionary(i => i.Id));
+ return new ConcurrentDictionary<Guid, BaseItem>(ourChildren.ToDictionary(i => i.Id));
}
}
}
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 77500808cd..e46ec8d3b4 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -1,5 +1,4 @@
-using System.Collections;
-using MediaBrowser.Common.Extensions;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
@@ -8,6 +7,7 @@ using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
using System;
+using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs
index 306de1e3c4..c1ca5336bc 100644
--- a/MediaBrowser.Controller/IO/FileData.cs
+++ b/MediaBrowser.Controller/IO/FileData.cs
@@ -17,18 +17,22 @@ namespace MediaBrowser.Controller.IO
/// </summary>
/// <param name="path">The path.</param>
/// <param name="logger">The logger.</param>
+ /// <param name="args">The args.</param>
/// <param name="searchPattern">The search pattern.</param>
/// <param name="flattenFolderDepth">The flatten folder depth.</param>
/// <param name="resolveShortcuts">if set to <c>true</c> [resolve shortcuts].</param>
- /// <param name="args">The args.</param>
/// <returns>Dictionary{System.StringFileSystemInfo}.</returns>
/// <exception cref="System.ArgumentNullException">path</exception>
- public static Dictionary<string, FileSystemInfo> GetFilteredFileSystemEntries(string path, ILogger logger, string searchPattern = "*", int flattenFolderDepth = 0, bool resolveShortcuts = true, ItemResolveArgs args = null)
+ public static Dictionary<string, FileSystemInfo> GetFilteredFileSystemEntries(string path, ILogger logger, ItemResolveArgs args, string searchPattern = "*", int flattenFolderDepth = 0, bool resolveShortcuts = true)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException("path");
}
+ if (args == null)
+ {
+ throw new ArgumentNullException("args");
+ }
var entries = new DirectoryInfo(path).EnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
@@ -60,16 +64,13 @@ namespace MediaBrowser.Controller.IO
var data = new DirectoryInfo(newPath);
// add to our physical locations
- if (args != null)
- {
- args.AddAdditionalLocation(newPath);
- }
+ args.AddAdditionalLocation(newPath);
dict[newPath] = data;
}
else if (flattenFolderDepth > 0 && isDirectory)
{
- foreach (var child in GetFilteredFileSystemEntries(fullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
+ foreach (var child in GetFilteredFileSystemEntries(fullName, logger, args, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
{
dict[child.Key] = child.Value;
}
diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs
index ddfec703c5..f4165a6301 100644
--- a/MediaBrowser.Controller/Library/ILibraryManager.cs
+++ b/MediaBrowser.Controller/Library/ILibraryManager.cs
@@ -254,5 +254,12 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="item">The item.</param>
void ReportItemRemoved(BaseItem item);
+
+ /// <summary>
+ /// Finds the type of the collection.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <returns>System.String.</returns>
+ string FindCollectionType(BaseItem item);
}
} \ No newline at end of file