I lied - re-worked metadata folder handling again. Should now really only hit once and is available for other item types
This commit is contained in:
parent
442081f4e2
commit
6edc836ce5
|
@ -7,7 +7,13 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Store these to reduce disk access in Episode Resolver
|
/// Store these to reduce disk access in Episode Resolver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] MetadataFiles { get; set; }
|
public string[] MetadataFiles
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ResolveArgs.MetadataFiles ?? new string[] { };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the metafolder contains a given file
|
/// Determines if the metafolder contains a given file
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -67,6 +68,12 @@ namespace MediaBrowser.Controller.IO
|
||||||
args.IsBDFolder |= file.cFileName.Equals("bdmv", StringComparison.OrdinalIgnoreCase);
|
args.IsBDFolder |= file.cFileName.Equals("bdmv", StringComparison.OrdinalIgnoreCase);
|
||||||
args.IsDVDFolder |= file.cFileName.Equals("video_ts", StringComparison.OrdinalIgnoreCase);
|
args.IsDVDFolder |= file.cFileName.Equals("video_ts", StringComparison.OrdinalIgnoreCase);
|
||||||
args.IsHDDVDFolder |= file.cFileName.Equals("hvdvd_ts", StringComparison.OrdinalIgnoreCase);
|
args.IsHDDVDFolder |= file.cFileName.Equals("hvdvd_ts", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
//and check to see if it is a metadata folder and collect contents now if so
|
||||||
|
if (IsMetadataFolder(file.cFileName))
|
||||||
|
{
|
||||||
|
args.MetadataFiles = Directory.GetFiles(Path.Combine(args.Path, "metadata"), "*", SearchOption.TopDirectoryOnly);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +90,11 @@ namespace MediaBrowser.Controller.IO
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsMetadataFolder(string path)
|
||||||
|
{
|
||||||
|
return path.TrimEnd('\\').EndsWith("metadata", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsVideoFile(string path)
|
public static bool IsVideoFile(string path)
|
||||||
{
|
{
|
||||||
string extension = System.IO.Path.GetExtension(path).ToLower();
|
string extension = System.IO.Path.GetExtension(path).ToLower();
|
||||||
|
|
|
@ -39,13 +39,10 @@ namespace MediaBrowser.Controller.Library
|
||||||
public bool IsDVDFolder { get; set; }
|
public bool IsDVDFolder { get; set; }
|
||||||
public bool IsHDDVDFolder { get; set; }
|
public bool IsHDDVDFolder { get; set; }
|
||||||
|
|
||||||
public bool IsMetadataFolder
|
/// <summary>
|
||||||
{
|
/// Store these to reduce disk access in Resolvers
|
||||||
get
|
/// </summary>
|
||||||
{
|
public string[] MetadataFiles { get; set; }
|
||||||
return this.FileInfo.cFileName.Equals("metadata", StringComparison.OrdinalIgnoreCase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public WIN32_FIND_DATA? GetFileSystemEntry(string path)
|
public WIN32_FIND_DATA? GetFileSystemEntry(string path)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
public static List<string> IgnoreFolders = new List<string>()
|
public static List<string> IgnoreFolders = new List<string>()
|
||||||
{
|
{
|
||||||
"trailers",
|
"trailers",
|
||||||
|
"metadata",
|
||||||
"bdmv",
|
"bdmv",
|
||||||
"certificate",
|
"certificate",
|
||||||
"backup",
|
"backup",
|
||||||
|
@ -62,11 +63,6 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
// Ignore any folders containing a file called .ignore
|
// Ignore any folders containing a file called .ignore
|
||||||
resolve = false;
|
resolve = false;
|
||||||
}
|
}
|
||||||
else if (args.IsMetadataFolder)
|
|
||||||
{
|
|
||||||
// I think this is redundant, but...
|
|
||||||
resolve = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return resolve;
|
return resolve;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
|
|
||||||
protected override Folder Resolve(ItemResolveEventArgs args)
|
protected override Folder Resolve(ItemResolveEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.IsDirectory && !args.IsMetadataFolder)
|
if (args.IsDirectory)
|
||||||
{
|
{
|
||||||
return new Folder() { PhysicalLocations = args.PhysicalLocations };
|
return new Folder() { PhysicalLocations = args.PhysicalLocations };
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,12 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||||
{
|
{
|
||||||
protected override Season Resolve(ItemResolveEventArgs args)
|
protected override Season Resolve(ItemResolveEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Parent is Series && args.IsDirectory && !args.IsMetadataFolder)
|
if (args.Parent is Series && args.IsDirectory)
|
||||||
{
|
{
|
||||||
var season = new Season { };
|
var season = new Season { };
|
||||||
|
|
||||||
season.IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path);
|
season.IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path);
|
||||||
|
|
||||||
// Gather these now so that the episode provider classes can utilize them instead of having to make their own file system calls
|
|
||||||
season.MetadataFiles = args.ContainsFolder("metadata") ? Directory.GetFiles(Path.Combine(args.Path, "metadata"), "*", SearchOption.TopDirectoryOnly) : new string[] { };
|
|
||||||
|
|
||||||
return season;
|
return season;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user