From dbf214883c0199be4a7a1bc02145c014fc029c0e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 1 Jun 2013 18:18:27 -0400 Subject: [PATCH] don't allow theme songs to get mixed in with children --- MediaBrowser.Controller/Entities/BaseItem.cs | 3 ++- .../Library/CoreResolutionIgnoreRule.cs | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index e4e3debe96..ef1efd8af9 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -52,6 +52,7 @@ namespace MediaBrowser.Controller.Entities /// public const string TrailerFolderName = "trailers"; public const string ThemeSongsFolderName = "theme-music"; + public const string ThemeSongFilename = "theme"; public const string ThemeVideosFolderName = "backdrops"; public const string XbmcTrailerFileSuffix = "-trailer"; @@ -822,7 +823,7 @@ namespace MediaBrowser.Controller.Entities // Support plex/xbmc convention files.AddRange(resolveArgs.FileSystemChildren - .Where(i => string.Equals(System.IO.Path.GetFileNameWithoutExtension(i.FullName), "theme", StringComparison.OrdinalIgnoreCase) && EntityResolutionHelper.IsAudioFile(i.FullName)) + .Where(i => string.Equals(System.IO.Path.GetFileNameWithoutExtension(i.FullName), ThemeSongFilename, StringComparison.OrdinalIgnoreCase) && EntityResolutionHelper.IsAudioFile(i.FullName)) ); return LibraryManager.ResolvePaths(files, null).Select(audio => diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 6112862af4..612dc0d42f 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -77,7 +77,8 @@ namespace MediaBrowser.Server.Implementations.Library } // Ignore trailer folders but allow it at the collection level - if (string.Equals(filename, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase) && !(args.Parent is AggregateFolder) && !(args.Parent is UserRootFolder)) + if (string.Equals(filename, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase) && + !(args.Parent is AggregateFolder) && !(args.Parent is UserRootFolder)) { return true; } @@ -92,6 +93,18 @@ namespace MediaBrowser.Server.Implementations.Library return true; } } + else + { + if (args.Parent != null) + { + var filename = args.FileInfo.Name; + + if (string.Equals(Path.GetFileNameWithoutExtension(filename), BaseItem.ThemeSongFilename) && EntityResolutionHelper.IsAudioFile(filename)) + { + return true; + } + } + } return false; }