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

29 lines
1.0 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using System.ComponentModel.Composition;
2012-07-12 06:55:27 +00:00
using System.IO;
namespace MediaBrowser.Controller.Resolvers.TV
2012-07-12 06:55:27 +00:00
{
[Export(typeof(IBaseItemResolver))]
public class SeasonResolver : BaseFolderResolver<Season>
2012-07-12 06:55:27 +00:00
{
protected override Season Resolve(ItemResolveEventArgs args)
{
if (args.Parent is Series && args.IsDirectory && !args.IsMetadataFolder)
2012-07-12 06:55:27 +00:00
{
2012-09-11 19:37:14 +00:00
var season = new Season { };
2012-07-12 06:55:27 +00:00
2012-08-27 12:18:59 +00:00
season.IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path);
// Gather these now so that the episode provider classes can utilize them instead of having to make their own file system calls
2012-09-11 19:37:14 +00:00
season.MetadataFiles = args.ContainsFolder("metadata") ? Directory.GetFiles(Path.Combine(args.Path, "metadata"), "*", SearchOption.TopDirectoryOnly) : new string[] { };
2012-07-12 06:55:27 +00:00
return season;
}
return null;
}
}
}