mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-05 15:28:28 +01:00
Merge with default
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
item.Parent = args.Parent;
|
||||
}
|
||||
|
||||
item.Id = Kernel.GetMD5(item.Path);
|
||||
item.Id = (item.GetType().FullName + item.Path).GetMD5();
|
||||
}
|
||||
|
||||
public BaseItem ResolvePath(ItemResolveEventArgs args)
|
||||
|
||||
68
MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
Normal file
68
MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
{
|
||||
public static class EntityResolutionHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Any folder named in this list will be ignored - can be added to at runtime for extensibility
|
||||
/// </summary>
|
||||
public static List<string> IgnoreFolders = new List<string>()
|
||||
{
|
||||
"trailers",
|
||||
"metadata",
|
||||
"bdmv",
|
||||
"certificate",
|
||||
"backup",
|
||||
"video_ts",
|
||||
"audio_ts",
|
||||
"ps3_update",
|
||||
"ps3_vprm"
|
||||
};
|
||||
/// <summary>
|
||||
/// Determines whether a path should be resolved or ignored entirely - called before we even look at the contents
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>false if the path should be ignored</returns>
|
||||
public static bool ShouldResolvePath(WIN32_FIND_DATA path)
|
||||
{
|
||||
bool resolve = true;
|
||||
// Ignore hidden files and folders
|
||||
if (path.IsHidden || path.IsSystemFile)
|
||||
{
|
||||
resolve = false;
|
||||
}
|
||||
|
||||
// Ignore any folders in our list
|
||||
else if (path.IsDirectory && IgnoreFolders.Contains(Path.GetFileName(path.Path), StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
resolve = false;
|
||||
}
|
||||
|
||||
return resolve;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a path should be ignored based on its contents - called after the contents have been read
|
||||
/// </summary>
|
||||
public static bool ShouldResolvePathContents(ItemResolveEventArgs args)
|
||||
{
|
||||
bool resolve = true;
|
||||
if (args.ContainsFile(".ignore"))
|
||||
{
|
||||
// Ignore any folders containing a file called .ignore
|
||||
resolve = false;
|
||||
}
|
||||
|
||||
return resolve;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
{
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
return new Folder();
|
||||
return new Folder() { PhysicalLocations = args.PhysicalLocations };
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -4,6 +4,7 @@ using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
{
|
||||
@@ -61,12 +62,27 @@ namespace MediaBrowser.Controller.Resolvers.Movies
|
||||
|
||||
private Movie GetMovie(ItemResolveEventArgs args)
|
||||
{
|
||||
// Loop through each child file/folder and see if we find a video
|
||||
for (var i = 0; i < args.FileSystemChildren.Length; i++)
|
||||
//first see if the discovery process has already determined we are a DVD or BD
|
||||
if (args.IsDVDFolder)
|
||||
{
|
||||
var child = args.FileSystemChildren[i];
|
||||
return new Movie()
|
||||
{
|
||||
Path = args.Path,
|
||||
VideoType = VideoType.DVD
|
||||
};
|
||||
}
|
||||
else if (args.IsBDFolder)
|
||||
{
|
||||
return new Movie()
|
||||
{
|
||||
Path = args.Path,
|
||||
VideoType = VideoType.BluRay
|
||||
};
|
||||
}
|
||||
|
||||
var childArgs = new ItemResolveEventArgs
|
||||
// Loop through each child file/folder and see if we find a video
|
||||
foreach (var child in args.FileSystemChildren)
|
||||
{
|
||||
{
|
||||
FileInfo = child,
|
||||
FileSystemChildren = new WIN32_FIND_DATA[] { },
|
||||
|
||||
Reference in New Issue
Block a user