2012-09-08 19:05:18 +00:00
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
|
using MediaBrowser.Model.Entities.TV;
|
|
|
|
|
using System.ComponentModel.Composition;
|
2012-07-12 06:55:27 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
2012-09-08 19:05:18 +00:00
|
|
|
|
namespace MediaBrowser.Controller.Resolvers.TV
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
2012-07-26 02:33:11 +00:00
|
|
|
|
[Export(typeof(IBaseItemResolver))]
|
|
|
|
|
public class SeasonResolver : BaseFolderResolver<Season>
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
protected override Season Resolve(ItemResolveEventArgs args)
|
|
|
|
|
{
|
2012-08-21 14:42:40 +00:00
|
|
|
|
if (args.Parent is Series && args.IsDirectory)
|
2012-07-12 06:55:27 +00:00
|
|
|
|
{
|
|
|
|
|
Season season = new Season();
|
|
|
|
|
|
2012-08-27 12:18:59 +00:00
|
|
|
|
season.IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path);
|
|
|
|
|
|
2012-08-23 18:35:44 +00: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-12 06:55:27 +00: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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|