diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-03 23:18:50 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-03 23:18:50 -0500 |
| commit | 40959a816f49d040e16e0178d0e11d51282d98cc (patch) | |
| tree | d93991283d10f87d398e34db79e292eea1bcfa34 /MediaBrowser.Controller/Entities/TV/Episode.cs | |
| parent | 61a78e2be961a7deb98558f2b872c417b03c885d (diff) | |
more support for episodes directly in a series folder
Diffstat (limited to 'MediaBrowser.Controller/Entities/TV/Episode.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Episode.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 40b999b02..e9f250d2a 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -235,6 +235,42 @@ namespace MediaBrowser.Controller.Entities.TV get { return LocationType == Model.Entities.LocationType.Virtual && IsUnaired; } } + [IgnoreDataMember] + public Guid? SeasonId + { + get + { + // First see if the parent is a Season + var season = Parent as Season; + + if (season != null) + { + return season.Id; + } + + var seasonNumber = ParentIndexNumber; + + // Parent is a Series + if (seasonNumber.HasValue) + { + var series = Parent as Series; + + if (series != null) + { + season = series.Children.OfType<Season>() + .FirstOrDefault(i => i.IndexNumber.HasValue && i.IndexNumber.Value == seasonNumber.Value); + + if (season != null) + { + return season.Id; + } + } + } + + return null; + } + } + public override IEnumerable<string> GetDeletePaths() { return new[] { Path }; |
