mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 23:08:42 +01:00
Added some resolver improvements
This commit is contained in:
parent
b50f78e5da
commit
4c9f77eead
@@ -14,9 +14,15 @@ namespace MediaBrowser.TV.Resolvers
|
||||
{
|
||||
if (args.IsFolder)
|
||||
{
|
||||
// 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)
|
||||
if (metadataFile.HasValue || Path.GetFileName(args.Path).IndexOf("[tvdbid=", StringComparison.OrdinalIgnoreCase) != -1 || TVUtils.IsSeriesFolder(args.Path, args.FileSystemChildren))
|
||||
{
|
||||
return new Series();
|
||||
}
|
||||
|
||||
@@ -52,14 +52,27 @@ namespace MediaBrowser.TV
|
||||
return seasonPathExpressions.Any(r => r.IsMatch(path));
|
||||
}
|
||||
|
||||
public static bool IsSeriesFolder(string path, IEnumerable<string> files, IEnumerable<string> folders)
|
||||
public static bool IsSeriesFolder(string path, IEnumerable<KeyValuePair<string, FileAttributes>> fileSystemChildren)
|
||||
{
|
||||
if (folders.Any(f => IsSeasonFolder(f)))
|
||||
foreach (var child in fileSystemChildren)
|
||||
{
|
||||
return true;
|
||||
if (child.Value.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
if (IsSeasonFolder(child.Key))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(EpisodeNumberFromFile(child.Key, false)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return files.Any(f => !string.IsNullOrEmpty(EpisodeNumberFromFile(f, false)));
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsEpisode(string fullPath)
|
||||
|
||||
Reference in New Issue
Block a user