mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
Hopefully the last of dealing with the metadata folder
This commit is contained in:
parent
68de4a6568
commit
2c563ac92f
8 changed files with 53 additions and 39 deletions
|
@ -83,5 +83,38 @@ namespace MediaBrowser.Controller.IO
|
||||||
return args;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,10 +200,10 @@ namespace MediaBrowser.Controller
|
||||||
DirectoryWatchers.Start();
|
DirectoryWatchers.Start();
|
||||||
//Task.Delay(30000); //let's wait and see if more data gets filled in...
|
//Task.Delay(30000); //let's wait and see if more data gets filled in...
|
||||||
var allChildren = RootFolder.RecursiveChildren;
|
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)
|
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 + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,14 @@ 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
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.FileInfo.cFileName.Equals("metadata", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public WIN32_FIND_DATA? GetFileSystemEntry(string path)
|
public WIN32_FIND_DATA? GetFileSystemEntry(string path)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA entry = FileSystemChildren.FirstOrDefault(f => f.Path.Equals(path, StringComparison.OrdinalIgnoreCase));
|
WIN32_FIND_DATA entry = FileSystemChildren.FirstOrDefault(f => f.Path.Equals(path, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
|
@ -62,6 +62,11 @@ 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)
|
||||||
|
{
|
||||||
|
// Don't retrieve these children here - we'll get them in the season resolver
|
||||||
|
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.FileInfo.cFileName.Equals("metadata",System.StringComparison.OrdinalIgnoreCase))
|
if (args.IsDirectory && !args.IsMetadataFolder)
|
||||||
{
|
{
|
||||||
return new Folder() { PhysicalLocations = args.PhysicalLocations };
|
return new Folder() { PhysicalLocations = args.PhysicalLocations };
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||||
{
|
{
|
||||||
protected override Season Resolve(ItemResolveEventArgs args)
|
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 { };
|
var season = new Season { };
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Controller.Resolvers.TV
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(EpisodeNumberFromFile(child.Path, false)))
|
if (FileSystemHelper.IsVideoFile(child.Path) && !string.IsNullOrEmpty(EpisodeNumberFromFile(child.Path, false)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ namespace MediaBrowser.Controller.Resolvers
|
||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
if (!args.IsDirectory)
|
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;
|
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;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue