diff options
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/Audio.cs | 48 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs | 9 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 26 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/IHasMetadata.cs | 2 |
4 files changed, 42 insertions, 43 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 3ebf4da00..02a9f15a9 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 7af8161ca..acda9ae02 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 c41d3e0cd..4416c5e91 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 59d9bd9f9..4146686b2 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 |
