From c309ff653a2be44c4d3b7cbae388bb121406725c Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Tue, 26 Mar 2013 20:28:07 -0400 Subject: [PATCH] Inherit ratings for episodes and seasons from series --- MediaBrowser.Controller/Entities/BaseItem.cs | 4 ++-- .../Entities/TV/Episode.cs | 24 +++++++++++++++++++ MediaBrowser.Controller/Entities/TV/Season.cs | 24 +++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 4f34f2b675..474d14ee1d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -500,13 +500,13 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the official rating. /// /// The official rating. - public string OfficialRating { get; set; } + public virtual string OfficialRating { get; set; } /// /// Gets or sets the custom rating. /// /// The custom rating. - public string CustomRating { get; set; } + public virtual string CustomRating { get; set; } /// /// Gets or sets the language. diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 1ec3e97a9f..7588e4e692 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -117,6 +117,30 @@ namespace MediaBrowser.Controller.Entities.TV } } + /// + /// Our rating comes from our series + /// + public override string OfficialRating + { + get { return Series != null ? Series.OfficialRating : base.OfficialRating; } + set + { + base.OfficialRating = value; + } + } + + /// + /// Our rating comes from our series + /// + public override string CustomRating + { + get { return Series != null ? Series.CustomRating : base.CustomRating; } + set + { + base.CustomRating = value; + } + } + /// /// We persist the MB Id of our series object so we can always find it no matter /// what context we happen to be loaded from. diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 20c2ee1fed..2f2bee1721 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -111,6 +111,30 @@ namespace MediaBrowser.Controller.Entities.TV get { return _series ?? (_series = FindParent()); } } + /// + /// Our rating comes from our series + /// + public override string OfficialRating + { + get { return Series != null ? Series.OfficialRating : base.OfficialRating; } + set + { + base.OfficialRating = value; + } + } + + /// + /// Our rating comes from our series + /// + public override string CustomRating + { + get { return Series != null ? Series.CustomRating : base.CustomRating; } + set + { + base.CustomRating = value; + } + } + /// /// Add files from the metadata folder to ResolveArgs ///