From 38fe239f4490eb4bf839e9b872f7d9c8172decf9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 13 Sep 2017 14:41:48 -0400 Subject: [PATCH] 3.2.30.19 --- .../Channels/ChannelManager.cs | 4 ++ .../LiveTv/LiveTvManager.cs | 5 ++ .../LiveTv/LiveTvMediaSourceProvider.cs | 2 + MediaBrowser.Api/ItemUpdateService.cs | 2 + MediaBrowser.Api/StartupWizardService.cs | 1 - .../Entities/Audio/Audio.cs | 48 ++++++------------- .../Entities/Audio/MusicAlbum.cs | 9 ++-- MediaBrowser.Controller/Entities/BaseItem.cs | 26 ++++++++-- .../Entities/IHasMetadata.cs | 2 + .../Configuration/ServerConfiguration.cs | 1 - .../BoxSets/BoxSetMetadataService.cs | 4 +- .../Manager/MetadataService.cs | 18 +++---- .../Music/AlbumMetadataService.cs | 4 +- .../Music/ArtistMetadataService.cs | 4 +- .../Playlists/PlaylistMetadataService.cs | 4 +- .../TV/EpisodeMetadataService.cs | 4 +- .../TV/SeasonMetadataService.cs | 4 +- SharedVersion.cs | 2 +- 18 files changed, 78 insertions(+), 66 deletions(-) diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 2f726f8abc..d3950929d4 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -426,6 +426,8 @@ namespace Emby.Server.Implementations.Channels item.Name = channelInfo.Name; } + item.OnMetadataChanged(); + if (isNew) { _libraryManager.CreateItem(item, cancellationToken); @@ -1384,6 +1386,8 @@ namespace Emby.Server.Implementations.Channels item.SetImagePath(ImageType.Primary, info.ImageUrl); } + item.OnMetadataChanged(); + if (isNew) { _libraryManager.CreateItem(item, cancellationToken); diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index dc212492e0..870a3b4937 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -752,6 +752,11 @@ namespace Emby.Server.Implementations.LiveTv } } + if (isNew || isUpdated) + { + item.OnMetadataChanged(); + } + return new Tuple(item, isNew, isUpdated); } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs index 0e52f874d4..62906f5d4e 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs @@ -142,6 +142,8 @@ namespace Emby.Server.Implementations.LiveTv var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false); stream = info.Item1; directStreamProvider = info.Item2; + + allowLiveStreamProbe = false; } else { diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 9e83cf680f..53a67ff712 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -214,6 +214,8 @@ namespace MediaBrowser.Api UpdateItem(request, item); + item.OnMetadataChanged(); + await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); if (isLockedChanged && item.IsFolder) diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index b15e06c9c0..22f1f3b62c 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -89,7 +89,6 @@ namespace MediaBrowser.Api private void SetWizardFinishValues(ServerConfiguration config) { - config.EnableStandaloneMusicKeys = true; config.EnableCaseSensitiveItemIds = true; config.SkipDeserializationForBasicTypes = true; config.EnableLocalizedGuids = true; diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 3ebf4da009..02a9f15a95 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -154,46 +154,28 @@ namespace MediaBrowser.Controller.Entities.Audio { var list = base.GetUserDataKeys(); - if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys) - { - var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; - - - if (ParentIndexNumber.HasValue) - { - songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; - } - songKey += Name; + var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; - if (!string.IsNullOrWhiteSpace(Album)) - { - songKey = Album + "-" + songKey; - } - - var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0]; - if (!string.IsNullOrWhiteSpace(albumArtist)) - { - songKey = albumArtist + "-" + songKey; - } - list.Insert(0, songKey); - } - else + if (ParentIndexNumber.HasValue) { - var parent = AlbumEntity; + songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; + } + songKey += Name; - if (parent != null && IndexNumber.HasValue) - { - list.InsertRange(0, parent.GetUserDataKeys().Select(i => - { - var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "") - + IndexNumber.Value.ToString("0000 - "); + if (!string.IsNullOrWhiteSpace(Album)) + { + songKey = Album + "-" + songKey; + } - return i + songKey; - })); - } + var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0]; + if (!string.IsNullOrWhiteSpace(albumArtist)) + { + songKey = albumArtist + "-" + songKey; } + list.Insert(0, songKey); + return list; } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 7af8161cab..acda9ae02b 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -145,13 +145,10 @@ namespace MediaBrowser.Controller.Entities.Audio { var list = base.GetUserDataKeys(); - if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys) + var albumArtist = AlbumArtist; + if (!string.IsNullOrWhiteSpace(albumArtist)) { - var albumArtist = AlbumArtist; - if (!string.IsNullOrWhiteSpace(albumArtist)) - { - list.Insert(0, albumArtist + "-" + Name); - } + list.Insert(0, albumArtist + "-" + Name); } var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum); diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c41d3e0cda..4416c5e916 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -918,9 +918,10 @@ namespace MediaBrowser.Controller.Entities { get { - if (!string.IsNullOrWhiteSpace(OfficialRating)) + var officialRating = OfficialRating; + if (!string.IsNullOrWhiteSpace(officialRating)) { - return OfficialRating; + return officialRating; } var parent = DisplayParent; @@ -938,9 +939,10 @@ namespace MediaBrowser.Controller.Entities { get { - if (!string.IsNullOrWhiteSpace(CustomRating)) + var customRating = CustomRating; + if (!string.IsNullOrWhiteSpace(customRating)) { - return CustomRating; + return customRating; } var parent = DisplayParent; @@ -2480,5 +2482,21 @@ namespace MediaBrowser.Controller.Entities { return null; } + + public virtual ItemUpdateType OnMetadataChanged() + { + var updateType = ItemUpdateType.None; + + var item = this; + + var inheritedParentalRatingValue = item.GetInheritedParentalRatingValue() ?? 0; + if (inheritedParentalRatingValue != item.InheritedParentalRatingValue) + { + item.InheritedParentalRatingValue = inheritedParentalRatingValue; + updateType |= ItemUpdateType.MetadataImport; + } + + return updateType; + } } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Entities/IHasMetadata.cs b/MediaBrowser.Controller/Entities/IHasMetadata.cs index 59d9bd9f90..4146686b21 100644 --- a/MediaBrowser.Controller/Entities/IHasMetadata.cs +++ b/MediaBrowser.Controller/Entities/IHasMetadata.cs @@ -266,6 +266,8 @@ namespace MediaBrowser.Controller.Entities int? ProductionYear { get; set; } string[] Tags { get; set; } + + ItemUpdateType OnMetadataChanged(); } public static class HasMetadataExtensions diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 5177a757a9..ae04bbaab6 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -179,7 +179,6 @@ namespace MediaBrowser.Model.Configuration public int SchemaVersion { get; set; } public bool EnableAnonymousUsageReporting { get; set; } - public bool EnableStandaloneMusicKeys { get; set; } public bool EnableFolderView { get; set; } public bool EnableGroupingIntoCollections { get; set; } public bool DisplaySpecialsWithinSeasons { get; set; } diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index 12748a8a77..2c3dc0e31d 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -14,9 +14,9 @@ namespace MediaBrowser.Providers.BoxSets { public class BoxSetMetadataService : MetadataService { - protected override ItemUpdateType BeforeSave(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType) + protected override ItemUpdateType BeforeSaveInternal(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType) { - var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType); + var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); if (isFullRefresh || currentUpdateType > ItemUpdateType.None) { diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 9a7ced0a5c..ae029cc594 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -281,7 +281,16 @@ namespace MediaBrowser.Providers.Manager /// if set to true [is full refresh]. /// Type of the current update. /// ItemUpdateType. - protected virtual ItemUpdateType BeforeSave(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType) + private ItemUpdateType BeforeSave(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType) + { + var updateType = BeforeSaveInternal(item, isFullRefresh, currentUpdateType); + + updateType |= item.OnMetadataChanged(); + + return updateType; + } + + protected virtual ItemUpdateType BeforeSaveInternal(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType) { var updateType = ItemUpdateType.None; @@ -295,13 +304,6 @@ namespace MediaBrowser.Providers.Manager updateType |= ItemUpdateType.MetadataImport; } - var inheritedParentalRatingValue = item.GetInheritedParentalRatingValue() ?? 0; - if (inheritedParentalRatingValue != item.InheritedParentalRatingValue) - { - item.InheritedParentalRatingValue = inheritedParentalRatingValue; - updateType |= ItemUpdateType.MetadataImport; - } - return updateType; } diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index 4230c517ae..48f520681a 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -16,9 +16,9 @@ namespace MediaBrowser.Providers.Music { public class AlbumMetadataService : MetadataService { - protected override ItemUpdateType BeforeSave(MusicAlbum item, bool isFullRefresh, ItemUpdateType currentUpdateType) + protected override ItemUpdateType BeforeSaveInternal(MusicAlbum item, bool isFullRefresh, ItemUpdateType currentUpdateType) { - var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType); + var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); if (isFullRefresh || currentUpdateType > ItemUpdateType.None) { diff --git a/MediaBrowser.Providers/Music/ArtistMetadataService.cs b/MediaBrowser.Providers/Music/ArtistMetadataService.cs index 0ff161576f..70ae525445 100644 --- a/MediaBrowser.Providers/Music/ArtistMetadataService.cs +++ b/MediaBrowser.Providers/Music/ArtistMetadataService.cs @@ -15,9 +15,9 @@ namespace MediaBrowser.Providers.Music { public class ArtistMetadataService : MetadataService { - protected override ItemUpdateType BeforeSave(MusicArtist item, bool isFullRefresh, ItemUpdateType currentUpdateType) + protected override ItemUpdateType BeforeSaveInternal(MusicArtist item, bool isFullRefresh, ItemUpdateType currentUpdateType) { - var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType); + var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); if (isFullRefresh || currentUpdateType > ItemUpdateType.None) { diff --git a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs index d39d3baf5d..a81facfb51 100644 --- a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs +++ b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs @@ -34,9 +34,9 @@ namespace MediaBrowser.Providers.Playlists } } - protected override ItemUpdateType BeforeSave(Playlist item, bool isFullRefresh, ItemUpdateType currentUpdateType) + protected override ItemUpdateType BeforeSaveInternal(Playlist item, bool isFullRefresh, ItemUpdateType currentUpdateType) { - var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType); + var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); if (isFullRefresh || currentUpdateType > ItemUpdateType.None) { diff --git a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs index 29533a46be..49175f62f9 100644 --- a/MediaBrowser.Providers/TV/EpisodeMetadataService.cs +++ b/MediaBrowser.Providers/TV/EpisodeMetadataService.cs @@ -16,9 +16,9 @@ namespace MediaBrowser.Providers.TV { public class EpisodeMetadataService : MetadataService { - protected override ItemUpdateType BeforeSave(Episode item, bool isFullRefresh, ItemUpdateType currentUpdateType) + protected override ItemUpdateType BeforeSaveInternal(Episode item, bool isFullRefresh, ItemUpdateType currentUpdateType) { - var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType); + var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); var seriesName = item.FindSeriesName(); if (!string.Equals(item.SeriesName, seriesName, StringComparison.Ordinal)) diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.cs index 7cd4087911..4e712d3e36 100644 --- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs @@ -17,9 +17,9 @@ namespace MediaBrowser.Providers.TV { public class SeasonMetadataService : MetadataService { - protected override ItemUpdateType BeforeSave(Season item, bool isFullRefresh, ItemUpdateType currentUpdateType) + protected override ItemUpdateType BeforeSaveInternal(Season item, bool isFullRefresh, ItemUpdateType currentUpdateType) { - var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType); + var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType); if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0) { diff --git a/SharedVersion.cs b/SharedVersion.cs index 1f5bfba76d..8d5353ca56 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.30.18")] +[assembly: AssemblyVersion("3.2.30.19")]