using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using System;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
{
///
/// Class SeasonResolver
///
public class SeasonResolver : FolderResolver
{
///
/// Resolves the specified args.
///
/// The args.
/// Season.
protected override Season Resolve(ItemResolveArgs args)
{
if (args.Parent is Series && args.IsDirectory)
{
return new Season
{
IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path)
};
}
return null;
}
///
/// Sets the initial item values.
///
/// The item.
/// The args.
protected override void SetInitialItemValues(Season item, ItemResolveArgs args)
{
base.SetInitialItemValues(item, args);
var series = args.Parent as Series;
item.SeriesItemId = series != null ? series.Id : Guid.Empty;
Season.AddMetadataFiles(args);
}
}
}