2013-05-24 08:01:53 -07:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
|
using MediaBrowser.Controller.Entities.TV;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
2014-12-14 22:16:23 -07:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2013-03-02 23:58:04 -07:00
|
|
|
|
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
2013-02-20 18:33:05 -07:00
|
|
|
|
{
|
2013-02-23 00:57:11 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class SeasonResolver
|
|
|
|
|
/// </summary>
|
2013-03-02 23:58:04 -07:00
|
|
|
|
public class SeasonResolver : FolderResolver<Season>
|
2013-02-20 18:33:05 -07:00
|
|
|
|
{
|
2013-05-24 08:01:53 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The _config
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IServerConfigurationManager _config;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="config">The config.</param>
|
|
|
|
|
public SeasonResolver(IServerConfigurationManager config)
|
|
|
|
|
{
|
|
|
|
|
_config = config;
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-23 00:57:11 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves the specified args.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
|
/// <returns>Season.</returns>
|
2013-02-20 18:33:05 -07:00
|
|
|
|
protected override Season Resolve(ItemResolveArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Parent is Series && args.IsDirectory)
|
|
|
|
|
{
|
2013-05-24 08:01:53 -07:00
|
|
|
|
var season = new Season
|
2013-02-20 18:33:05 -07:00
|
|
|
|
{
|
2014-12-14 22:16:23 -07:00
|
|
|
|
IndexNumber = SeriesResolver.GetSeasonNumberFromPath(args.Path, CollectionType.TvShows)
|
2013-02-20 18:33:05 -07:00
|
|
|
|
};
|
2014-11-16 13:44:08 -07:00
|
|
|
|
|
2013-05-24 08:01:53 -07:00
|
|
|
|
if (season.IndexNumber.HasValue && season.IndexNumber.Value == 0)
|
|
|
|
|
{
|
|
|
|
|
season.Name = _config.Configuration.SeasonZeroDisplayName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return season;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|