From 1a9e2dfd83dbab2e9a5f277229c5994253fd8a9a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 17 Feb 2014 16:35:08 -0500 Subject: fixed themoviedb search returning no results --- .../Library/CoreResolutionIgnoreRule.cs | 20 ++++----- .../Library/LibraryManager.cs | 3 +- .../Library/Validators/CountHelpers.cs | 52 +++++++++++----------- 3 files changed, 38 insertions(+), 37 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library') diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 98a87d03d..c830c13b8 100644 --- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -17,17 +17,15 @@ namespace MediaBrowser.Server.Implementations.Library /// /// Any folder named in this list will be ignored - can be added to at runtime for extensibility /// - private static readonly Dictionary IgnoreFolders = new List + private static readonly Dictionary IgnoreFolders = new List { - "metadata", - "certificate", - "backup", - "ps3_update", - "ps3_vprm", - "adv_obj", - "extrafanart", - "extrathumbs", - ".actors" + "metadata", + "ps3_update", + "ps3_vprm", + "extrafanart", + "extrathumbs", + ".actors", + ".wd_tv" }.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); @@ -51,7 +49,7 @@ namespace MediaBrowser.Server.Implementations.Library // https://github.com/MediaBrowser/MediaBrowser/issues/427 if (filename.IndexOf("._", StringComparison.OrdinalIgnoreCase) == 0) { - return true; + return true; } // Ignore hidden files and folders diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index b42541204..a06e03c4a 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1312,7 +1312,8 @@ namespace MediaBrowser.Server.Implementations.Library /// Task. public async Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken) { - if (item.LocationType == LocationType.FileSystem) + var locationType = item.LocationType; + if (locationType != LocationType.Remote && locationType != LocationType.Virtual) { await _providerManagerFactory().SaveMetadata(item, updateReason).ConfigureAwait(false); } diff --git a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs index 679eadb12..edb4e7382 100644 --- a/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs +++ b/MediaBrowser.Server.Implementations/Library/Validators/CountHelpers.cs @@ -13,51 +13,46 @@ namespace MediaBrowser.Server.Implementations.Library.Validators /// internal static class CountHelpers { - /// - /// Adds to dictionary. - /// - /// The item. - /// The counts. - internal static void AddToDictionary(BaseItem item, Dictionary counts) + private static CountType? GetCountType(BaseItem item) { if (item is Movie) { - IncrementCount(counts, CountType.Movie); + return CountType.Movie; } - else if (item is Trailer) + if (item is Episode) { - IncrementCount(counts, CountType.Trailer); + return CountType.Episode; } - else if (item is Series) + if (item is Game) { - IncrementCount(counts, CountType.Series); + return CountType.Game; } - else if (item is Game) + if (item is Audio) { - IncrementCount(counts, CountType.Game); + return CountType.Song; } - else if (item is Audio) + if (item is Trailer) { - IncrementCount(counts, CountType.Song); + return CountType.Trailer; } - else if (item is MusicAlbum) + if (item is Series) { - IncrementCount(counts, CountType.MusicAlbum); + return CountType.Series; } - else if (item is Episode) + if (item is MusicAlbum) { - IncrementCount(counts, CountType.Episode); + return CountType.MusicAlbum; } - else if (item is MusicVideo) + if (item is MusicVideo) { - IncrementCount(counts, CountType.MusicVideo); + return CountType.MusicVideo; } - else if (item is AdultVideo) + if (item is AdultVideo) { - IncrementCount(counts, CountType.AdultVideo); + return CountType.AdultVideo; } - IncrementCount(counts, CountType.Total); + return null; } /// @@ -129,6 +124,8 @@ namespace MediaBrowser.Server.Implementations.Library.Validators /// The master dictionary. internal static void SetItemCounts(Guid userId, BaseItem media, IEnumerable names, Dictionary>> masterDictionary) { + var countType = GetCountType(media); + foreach (var name in names) { Dictionary> libraryCounts; @@ -148,7 +145,12 @@ namespace MediaBrowser.Server.Implementations.Library.Validators libraryCounts.Add(userLibId, userDictionary); } - AddToDictionary(media, userDictionary); + if (countType.HasValue) + { + IncrementCount(userDictionary, countType.Value); + } + + IncrementCount(userDictionary, CountType.Total); } } } -- cgit v1.2.3