diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-06 10:58:49 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-06 10:58:49 -0500 |
| commit | 38d88aed5811d22feef83e05753d95624efe0ded (patch) | |
| tree | 7f762cbcb44d8d5ca2390b6b2991eb21d5d3f0d2 | |
| parent | ca0583bcbee3b2a66dfa2a25c63fb62081fe1239 (diff) | |
Inherit custom rating
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 18 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 21 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Season.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Providers/TV/TvdbEpisodeImageProvider.cs | 3 |
5 files changed, 32 insertions, 27 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index de5516e29..c21b9b05f 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -447,9 +447,23 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual string CustomRatingForComparison + public string CustomRatingForComparison { - get { return CustomRating; } + get + { + if (!string.IsNullOrEmpty(CustomRating)) + { + return CustomRating; + } + + var parent = Parent; + if (parent != null) + { + return parent.CustomRatingForComparison; + } + + return null; + } } /// <summary> diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 63a1c2bab..b625789a1 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1,11 +1,9 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Progress; using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Providers; -using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; using MoreLinq; using System; diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 73726a4e2..c1535bde0 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -98,9 +98,11 @@ namespace MediaBrowser.Controller.Entities.TV /// <returns>System.String.</returns> public override string GetUserDataKey() { - if (Series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue) + var series = Series; + + if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue) { - return Series.GetUserDataKey() + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000"); + return series.GetUserDataKey() + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000"); } return base.GetUserDataKey(); @@ -112,16 +114,11 @@ namespace MediaBrowser.Controller.Entities.TV [IgnoreDataMember] public override string OfficialRatingForComparison { - get { return Series != null ? Series.OfficialRatingForComparison : base.OfficialRatingForComparison; } - } - - /// <summary> - /// Our rating comes from our series - /// </summary> - [IgnoreDataMember] - public override string CustomRatingForComparison - { - get { return Series != null ? Series.CustomRatingForComparison : base.CustomRatingForComparison; } + get + { + var series = Series; + return series != null ? series.OfficialRatingForComparison : base.OfficialRatingForComparison; + } } /// <summary> diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 744416560..bc7e75b72 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -119,16 +119,11 @@ namespace MediaBrowser.Controller.Entities.TV [IgnoreDataMember] public override string OfficialRatingForComparison { - get { return Series != null ? Series.OfficialRatingForComparison : base.OfficialRatingForComparison; } - } - - /// <summary> - /// Our rating comes from our series - /// </summary> - [IgnoreDataMember] - public override string CustomRatingForComparison - { - get { return Series != null ? Series.CustomRatingForComparison : base.CustomRatingForComparison; } + get + { + var series = Series; + return series != null ? series.OfficialRatingForComparison : base.OfficialRatingForComparison; + } } /// <summary> diff --git a/MediaBrowser.Providers/TV/TvdbEpisodeImageProvider.cs b/MediaBrowser.Providers/TV/TvdbEpisodeImageProvider.cs index 6f988a2f6..162eb45bc 100644 --- a/MediaBrowser.Providers/TV/TvdbEpisodeImageProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbEpisodeImageProvider.cs @@ -61,8 +61,9 @@ namespace MediaBrowser.Providers.TV public Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken) { var episode = (Episode)item; + var series = episode.Series; - var seriesId = episode.Series != null ? episode.Series.GetProviderId(MetadataProviders.Tvdb) : null; + var seriesId = series != null ? series.GetProviderId(MetadataProviders.Tvdb) : null; if (!string.IsNullOrEmpty(seriesId)) { |
