Hopefully the last of dealing with the metadata folder

This commit is contained in:
ebr11 Eric Reed spam 2012-09-18 17:07:01 -04:00
parent 68de4a6568
commit 2c563ac92f
8 changed files with 53 additions and 39 deletions

View File

@ -83,5 +83,38 @@ namespace MediaBrowser.Controller.IO
return args;
}
public static bool IsVideoFile(string path)
{
string extension = System.IO.Path.GetExtension(path).ToLower();
switch (extension)
{
case ".mkv":
case ".m2ts":
case ".iso":
case ".ts":
case ".rmvb":
case ".mov":
case ".avi":
case ".mpg":
case ".mpeg":
case ".wmv":
case ".mp4":
case ".divx":
case ".dvr-ms":
case ".wtv":
case ".ogm":
case ".ogv":
case ".asf":
case ".m4v":
case ".flv":
case ".f4v":
case ".3gp":
return true;
default:
return false;
}
}
}
}

View File

@ -200,10 +200,10 @@ namespace MediaBrowser.Controller
DirectoryWatchers.Start();
//Task.Delay(30000); //let's wait and see if more data gets filled in...
var allChildren = RootFolder.RecursiveChildren;
Logger.LogInfo(string.Format("Loading complete. Movies: {0} Episodes: {1}", allChildren.OfType<Entities.Movies.Movie>().Count(), allChildren.OfType<Entities.TV.Episode>().Count()));
Logger.LogDebugInfo(string.Format("Loading complete. Movies: {0} Episodes: {1} Folders: {2}", allChildren.OfType<Entities.Movies.Movie>().Count(), allChildren.OfType<Entities.TV.Episode>().Count(), allChildren.Where(i => i is Folder && !(i is Series || i is Season)).Count()));
foreach (var child in allChildren)
{
Logger.LogDebugInfo("(" + child.GetType().Name + ") " + child.Name + " Overview " + (child.Overview != null ? child.Overview.Substring(0,Math.Min(25,child.Overview.Length)): "") + " (" + child.Path + ")");
Logger.LogDebugInfo("(" + child.GetType().Name + ") " + child.Name + " (" + child.Path + ")");
}
}

View File

@ -39,6 +39,14 @@ namespace MediaBrowser.Controller.Library
public bool IsDVDFolder { get; set; }
public bool IsHDDVDFolder { get; set; }
public bool IsMetadataFolder
{
get
{
return this.FileInfo.cFileName.Equals("metadata", StringComparison.OrdinalIgnoreCase);
}
}
public WIN32_FIND_DATA? GetFileSystemEntry(string path)
{
WIN32_FIND_DATA entry = FileSystemChildren.FirstOrDefault(f => f.Path.Equals(path, StringComparison.OrdinalIgnoreCase));

View File

@ -62,6 +62,11 @@ namespace MediaBrowser.Controller.Resolvers
// Ignore any folders containing a file called .ignore
resolve = false;
}
else if (args.IsMetadataFolder)
{
// Don't retrieve these children here - we'll get them in the season resolver
resolve = false;
}
return resolve;
}

View File

@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Resolvers
protected override Folder Resolve(ItemResolveEventArgs args)
{
if (args.IsDirectory && !args.FileInfo.cFileName.Equals("metadata",System.StringComparison.OrdinalIgnoreCase))
if (args.IsDirectory && !args.IsMetadataFolder)
{
return new Folder() { PhysicalLocations = args.PhysicalLocations };
}

View File

@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Resolvers.TV
{
protected override Season Resolve(ItemResolveEventArgs args)
{
if (args.Parent is Series && args.IsDirectory)
if (args.Parent is Series && args.IsDirectory && !args.IsMetadataFolder)
{
var season = new Season { };

View File

@ -128,7 +128,7 @@ namespace MediaBrowser.Controller.Resolvers.TV
}
else
{
if (!string.IsNullOrEmpty(EpisodeNumberFromFile(child.Path, false)))
if (FileSystemHelper.IsVideoFile(child.Path) && !string.IsNullOrEmpty(EpisodeNumberFromFile(child.Path, false)))
{
return true;
}

View File

@ -1,6 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Controller.IO;
using System.ComponentModel.Composition;
using System.IO;
@ -29,7 +30,7 @@ namespace MediaBrowser.Controller.Resolvers
// If the path is a file check for a matching extensions
if (!args.IsDirectory)
{
if (IsVideoFile(args.Path))
if (FileSystemHelper.IsVideoFile(args.Path))
{
VideoType type = Path.GetExtension(args.Path).EndsWith("iso", System.StringComparison.OrdinalIgnoreCase) ? VideoType.Iso : VideoType.VideoFile;
@ -95,38 +96,5 @@ namespace MediaBrowser.Controller.Resolvers
return null;
}
private static bool IsVideoFile(string path)
{
string extension = Path.GetExtension(path).ToLower();
switch (extension)
{
case ".mkv":
case ".m2ts":
case ".iso":
case ".ts":
case ".rmvb":
case ".mov":
case ".avi":
case ".mpg":
case ".mpeg":
case ".wmv":
case ".mp4":
case ".divx":
case ".dvr-ms":
case ".wtv":
case ".ogm":
case ".ogv":
case ".asf":
case ".m4v":
case ".flv":
case ".f4v":
case ".3gp":
return true;
default:
return false;
}
}
}
}