|
@@ -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;
|
|
|
}
|
|
|
|