You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.6 KiB
52 lines
1.6 KiB
using System;
|
|
using System.IO;
|
|
using MediaBrowser.Controller.Events;
|
|
using MediaBrowser.Controller.Resolvers;
|
|
using MediaBrowser.TV.Entities;
|
|
using MediaBrowser.TV.Metadata;
|
|
|
|
namespace MediaBrowser.TV.Resolvers
|
|
{
|
|
class SeriesResolver : BaseFolderResolver<Series>
|
|
{
|
|
protected override Series Resolve(ItemResolveEventArgs args)
|
|
{
|
|
if (args.IsFolder)
|
|
{
|
|
// Optimization to avoid running these tests against VF's
|
|
if (args.Parent != null && args.Parent.IsRoot)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
// Optimization to avoid running these tests against Seasons
|
|
if (args.Parent is Series)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var metadataFile = args.GetFileByName("series.xml");
|
|
|
|
if (metadataFile.HasValue || Path.GetFileName(args.Path).IndexOf("[tvdbid=", StringComparison.OrdinalIgnoreCase) != -1 || TVUtils.IsSeriesFolder(args.Path, args.FileSystemChildren))
|
|
{
|
|
return new Series();
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected override void SetItemValues(Series item, ItemResolveEventArgs args)
|
|
{
|
|
base.SetItemValues(item, args);
|
|
|
|
var metadataFile = args.GetFileByName("series.xml");
|
|
|
|
if (metadataFile.HasValue)
|
|
{
|
|
new SeriesXmlParser().Fetch(item, metadataFile.Value.Key);
|
|
}
|
|
}
|
|
}
|
|
}
|