more support for episodes directly in a series folder

This commit is contained in:
Luke Pulverenti
2013-12-03 23:18:50 -05:00
parent 61a78e2be9
commit 40959a816f
12 changed files with 231 additions and 32 deletions

View File

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