diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index 378c4a390b..c7a3c7778e 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Entities /// /// The date last refreshed. DateTime DateLastRefreshed { get; set; } - + /// /// This is called before any metadata refresh and returns true or false indicating if changes were made /// @@ -53,5 +53,11 @@ namespace MediaBrowser.Controller.Entities bool RequiresRefresh(); bool EnableForceSaveOnDateModifiedChange { get; } + + string PresentationUniqueKey { get; set; } + + string GetPresentationUniqueKey(); + string CreatePresentationUniqueKey(); + } } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 3297c2c6a6..f01eddcebb 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -109,17 +109,16 @@ namespace MediaBrowser.Controller.Entities.TV private string AddLibrariesToPresentationUniqueKey(string key) { - return key; - //var folders = LibraryManager.GetCollectionFolders(this) - // .Select(i => i.Id.ToString("N")) - // .ToArray(); + var folders = LibraryManager.GetCollectionFolders(this) + .Select(i => i.Id.ToString("N")) + .ToArray(); - //if (folders.Length == 0) - //{ - // return key; - //} + if (folders.Length == 0) + { + return key; + } - //return key + "-" + string.Join("-", folders); + return key + "-" + string.Join("-", folders); } private static string GetUniqueSeriesKey(BaseItem series) diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index ac942d1a76..0a70a2cc43 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -284,6 +284,13 @@ namespace MediaBrowser.Providers.Manager updateType |= SaveCumulativeRunTimeTicks(item, isFullRefresh, currentUpdateType); updateType |= SaveDateLastMediaAdded(item, isFullRefresh, currentUpdateType); + var presentationUniqueKey = item.CreatePresentationUniqueKey(); + if (!string.Equals(item.PresentationUniqueKey, presentationUniqueKey, StringComparison.Ordinal)) + { + item.PresentationUniqueKey = presentationUniqueKey; + updateType |= ItemUpdateType.MetadataImport; + } + return updateType; } diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index addab3918e..cf04a14184 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -35,26 +35,17 @@ namespace MediaBrowser.Providers.TV updateType |= SaveIsVirtualItem(item, episodes); } - if (updateType <= ItemUpdateType.None) + if (!string.Equals(item.SeriesName, item.FindSeriesName(), StringComparison.Ordinal)) { - if (!string.Equals(item.SeriesName, item.FindSeriesName(), StringComparison.Ordinal)) - { - updateType |= ItemUpdateType.MetadataImport; - } + updateType |= ItemUpdateType.MetadataImport; } - if (updateType <= ItemUpdateType.None) + if (!string.Equals(item.SeriesSortName, item.FindSeriesSortName(), StringComparison.Ordinal)) { - if (!string.Equals(item.SeriesSortName, item.FindSeriesSortName(), StringComparison.Ordinal)) - { - updateType |= ItemUpdateType.MetadataImport; - } + updateType |= ItemUpdateType.MetadataImport; } - if (updateType <= ItemUpdateType.None) + if (item.SeriesId != item.FindSeriesId()) { - if (item.SeriesId != item.FindSeriesId()) - { - updateType |= ItemUpdateType.MetadataImport; - } + updateType |= ItemUpdateType.MetadataImport; } return updateType;