diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/TV/Episode.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 726390f65..1a02043d6 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -135,7 +135,11 @@ namespace MediaBrowser.Controller.Entities.TV [IgnoreDataMember] public Series Series { - get { return FindParent<Series>(); } + get + { + var seriesId = SeriesId ?? FindSeriesId();
+ return seriesId.HasValue ? (LibraryManager.GetItemById(seriesId.Value) as Series) : null; + } } [IgnoreDataMember] @@ -143,24 +147,8 @@ namespace MediaBrowser.Controller.Entities.TV { get { - var season = FindParent<Season>(); - - // Episodes directly in series folder - if (season == null) - { - var series = Series; - - if (series != null && ParentIndexNumber.HasValue) - { - var findNumber = ParentIndexNumber.Value; - - season = series.Children - .OfType<Season>() - .FirstOrDefault(i => i.IndexNumber.HasValue && i.IndexNumber.Value == findNumber); - } - } - - return season; + var seasonId = SeasonId ?? FindSeasonId();
+ return seasonId.HasValue ? (LibraryManager.GetItemById(seasonId.Value) as Season) : null; } } @@ -193,7 +181,23 @@ namespace MediaBrowser.Controller.Entities.TV public Guid? FindSeasonId()
{
- var season = Season;
+ var season = FindParent<Season>();
+
+ // Episodes directly in series folder
+ if (season == null)
+ {
+ var series = Series;
+
+ if (series != null && ParentIndexNumber.HasValue)
+ {
+ var findNumber = ParentIndexNumber.Value;
+
+ season = series.Children
+ .OfType<Season>()
+ .FirstOrDefault(i => i.IndexNumber.HasValue && i.IndexNumber.Value == findNumber);
+ }
+ }
+
return season == null ? (Guid?)null : season.Id;
} @@ -263,7 +267,7 @@ namespace MediaBrowser.Controller.Entities.TV public Guid? FindSeriesId()
{
- var series = Series;
+ var series = FindParent<Series>(); return series == null ? (Guid?)null : series.Id;
} |
