using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
{
///
/// Class SeasonResolver
///
public class SeasonResolver : FolderResolver
{
///
/// The _config
///
private readonly IServerConfigurationManager _config;
///
/// Initializes a new instance of the class.
///
/// The config.
public SeasonResolver(IServerConfigurationManager config)
{
_config = config;
}
///
/// Resolves the specified args.
///
/// The args.
/// Season.
protected override Season Resolve(ItemResolveArgs args)
{
if (args.Parent is Series && args.IsDirectory)
{
var season = new Season
{
IndexNumber = SeriesResolver.GetSeasonNumberFromPath(args.Path)
};
if (season.IndexNumber.HasValue && season.IndexNumber.Value == 0)
{
season.Name = _config.Configuration.SeasonZeroDisplayName;
}
return season;
}
return null;
}
}
}