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