jellyfin/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs

64 lines
1.9 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.TV;
2013-02-21 01:33:05 +00:00
using MediaBrowser.Controller.Library;
namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
2013-02-21 01:33:05 +00:00
{
2013-02-23 07:57:11 +00:00
/// <summary>
/// Class SeasonResolver
/// </summary>
public class SeasonResolver : FolderResolver<Season>
2013-02-21 01:33:05 +00: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 07:57:11 +00:00
/// <summary>
/// Resolves the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns>Season.</returns>
2013-02-21 01:33:05 +00:00
protected override Season Resolve(ItemResolveArgs args)
{
if (args.Parent is Series && args.IsDirectory)
{
var season = new Season
2013-02-21 01:33:05 +00:00
{
IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path)
};
if (season.IndexNumber.HasValue && season.IndexNumber.Value == 0)
{
season.Name = _config.Configuration.SeasonZeroDisplayName;
}
return season;
2013-02-21 01:33:05 +00:00
}
return null;
}
2013-02-23 07:57:11 +00:00
/// <summary>
/// Sets the initial item values.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="args">The args.</param>
2013-02-21 01:33:05 +00:00
protected override void SetInitialItemValues(Season item, ItemResolveArgs args)
{
base.SetInitialItemValues(item, args);
Season.AddMetadataFiles(args);
}
}
}