From 5eb44c42c586af34dd16efc76240d0d6c8e02069 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 4 Dec 2014 00:24:41 -0500 Subject: [PATCH] resolve mixed folder detection --- MediaBrowser.Controller/Entities/BaseItem.cs | 28 +- MediaBrowser.Controller/Entities/Folder.cs | 8 +- .../Library/ILibraryManager.cs | 10 +- .../Resolvers/IItemResolver.cs | 23 ++ .../ContentDirectory/ControlHandler.cs | 5 +- .../Library/CoreResolutionIgnoreRule.cs | 5 - .../Library/EntityResolutionHelper.cs | 74 ----- .../Library/LibraryManager.cs | 106 +++--- .../Library/ResolverHelper.cs | 134 +++++++- .../Library/Resolvers/BaseVideoResolver.cs | 124 +++++--- .../Resolvers/Movies/BoxSetResolver.cs | 6 +- .../Library/Resolvers/Movies/MovieResolver.cs | 301 +++++++++++------- .../Library/Resolvers/PhotoResolver.cs | 4 +- .../Library/Resolvers/TV/EpisodeResolver.cs | 9 +- .../Library/Resolvers/TV/SeriesResolver.cs | 5 +- .../Library/Resolvers/VideoResolver.cs | 22 +- ...MediaBrowser.Server.Implementations.csproj | 2 +- .../packages.config | 2 +- 18 files changed, 506 insertions(+), 362 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 5f1d45fc87..072555986c 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -53,16 +53,6 @@ namespace MediaBrowser.Controller.Entities public static string ThemeSongFilename = "theme"; public static string ThemeVideosFolderName = "backdrops"; - public static List> ExtraSuffixes = new List> - { - new KeyValuePair("-trailer", ExtraType.Trailer), - new KeyValuePair("-deleted", ExtraType.DeletedScene), - new KeyValuePair("-behindthescenes", ExtraType.BehindTheScenes), - new KeyValuePair("-interview", ExtraType.Interview), - new KeyValuePair("-scene", ExtraType.Scene), - new KeyValuePair("-sample", ExtraType.Sample) - }; - public List ImageInfos { get; set; } [IgnoreDataMember] @@ -618,7 +608,9 @@ namespace MediaBrowser.Controller.Entities .Where(i => string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase)) ); - return LibraryManager.ResolvePaths(files, directoryService, null).Select(audio => + return LibraryManager.ResolvePaths(files, directoryService, null) + .OfType() + .Select(audio => { // Try to retrieve it from the db. If we don't find it, use the resolved version var dbItem = LibraryManager.GetItemById(audio.Id) as Audio.Audio; @@ -628,10 +620,7 @@ namespace MediaBrowser.Controller.Entities audio = dbItem; } - if (audio != null) - { - audio.ExtraType = ExtraType.ThemeSong; - } + audio.ExtraType = ExtraType.ThemeSong; return audio; @@ -649,7 +638,9 @@ namespace MediaBrowser.Controller.Entities .Where(i => string.Equals(i.Name, ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase)) .SelectMany(i => i.EnumerateFiles("*", SearchOption.TopDirectoryOnly)); - return LibraryManager.ResolvePaths