mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-17 10:58:58 -07:00
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System;
|
|
using System.ComponentModel.Composition;
|
|
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>
|
|
{
|
|
protected override Series Resolve(ItemResolveEventArgs args)
|
|
{
|
|
if (args.IsDirectory && (args.VirtualFolderCollectionType ?? string.Empty).Equals("TV", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
// Optimization to avoid running these tests against Seasons
|
|
if (args.Parent is Series)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var metadataFile = args.GetFileSystemEntryByName("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;
|
|
}
|
|
}
|
|
}
|