jellyfin-server/MediaBrowser.Controller/Resolvers/TV/SeasonResolver.cs

46 lines
1.3 KiB
C#
Raw Normal View History

2013-02-21 01:33:05 +00:00
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using System;
namespace MediaBrowser.Controller.Resolvers.TV
{
2013-02-23 07:57:11 +00:00
/// <summary>
/// Class SeasonResolver
/// </summary>
2013-02-21 01:33:05 +00:00
public class SeasonResolver : BaseFolderResolver<Season>
{
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)
{
return new Season
{
IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path)
};
}
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);
var series = args.Parent as Series;
item.SeriesItemId = series != null ? series.Id : Guid.Empty;
Season.AddMetadataFiles(args);
}
}
}