jellyfin/MediaBrowser.TV/Resolvers/SeriesResolver.cs

35 lines
1.2 KiB
C#
Raw Normal View History

2012-07-11 23:55:27 -07:00
using System;
using System.ComponentModel.Composition;
2012-07-11 23:55:27 -07:00
using System.IO;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.TV.Entities;
namespace MediaBrowser.TV.Resolvers
{
[Export(typeof(IBaseItemResolver))]
public class SeriesResolver : BaseFolderResolver<Series>
2012-07-11 23:55:27 -07:00
{
protected override Series Resolve(ItemResolveEventArgs args)
{
2012-08-21 07:42:40 -07:00
if (args.IsDirectory && (args.VirtualFolderCollectionType ?? string.Empty).Equals("TV", StringComparison.OrdinalIgnoreCase))
2012-07-11 23:55:27 -07:00
{
2012-07-12 10:09:35 -07:00
// Optimization to avoid running these tests against Seasons
if (args.Parent is Series)
{
return null;
}
var metadataFile = args.GetFileSystemEntryByName("series.xml");
2012-07-11 23:55:27 -07:00
2012-07-12 10:09:35 -07:00
if (metadataFile.HasValue || Path.GetFileName(args.Path).IndexOf("[tvdbid=", StringComparison.OrdinalIgnoreCase) != -1 || TVUtils.IsSeriesFolder(args.Path, args.FileSystemChildren))
2012-07-11 23:55:27 -07:00
{
return new Series();
}
}
return null;
}
}
}