mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-15 14:52:20 +01:00
update xml readers
This commit is contained in:
@@ -4,6 +4,8 @@ using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Naming.Video;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
@@ -59,7 +61,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
|
||||
if (child.IsDirectory)
|
||||
{
|
||||
if (IsDvdDirectory(filename))
|
||||
if (IsDvdDirectory(child.FullName, filename, args.DirectoryService))
|
||||
{
|
||||
videoInfo = parser.ResolveDirectory(args.Path);
|
||||
|
||||
@@ -76,7 +78,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
};
|
||||
break;
|
||||
}
|
||||
if (IsBluRayDirectory(filename))
|
||||
if (IsBluRayDirectory(child.FullName, filename, args.DirectoryService))
|
||||
{
|
||||
videoInfo = parser.ResolveDirectory(args.Path);
|
||||
|
||||
@@ -267,11 +269,14 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
/// <summary>
|
||||
/// Determines whether [is DVD directory] [the specified directory name].
|
||||
/// </summary>
|
||||
/// <param name="directoryName">Name of the directory.</param>
|
||||
/// <returns><c>true</c> if [is DVD directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
|
||||
protected bool IsDvdDirectory(string directoryName)
|
||||
protected bool IsDvdDirectory(string fullPath, string directoryName, IDirectoryService directoryService)
|
||||
{
|
||||
return string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase);
|
||||
if (!string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return directoryService.GetFiles(fullPath).Any(i => string.Equals(i.Extension, ".vob", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -287,11 +292,14 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
/// <summary>
|
||||
/// Determines whether [is blu ray directory] [the specified directory name].
|
||||
/// </summary>
|
||||
/// <param name="directoryName">Name of the directory.</param>
|
||||
/// <returns><c>true</c> if [is blu ray directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
|
||||
protected bool IsBluRayDirectory(string directoryName)
|
||||
protected bool IsBluRayDirectory(string fullPath, string directoryName, IDirectoryService directoryService)
|
||||
{
|
||||
return string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase);
|
||||
if (!string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return directoryService.GetFiles(fullPath).Any(i => string.Equals(i.Extension, ".m2ts", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
|
||||
if (child.IsDirectory)
|
||||
{
|
||||
if (IsDvdDirectory(filename))
|
||||
if (IsDvdDirectory(child.FullName, filename, directoryService))
|
||||
{
|
||||
var movie = new T
|
||||
{
|
||||
@@ -376,7 +376,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
Set3DFormat(movie);
|
||||
return movie;
|
||||
}
|
||||
if (IsBluRayDirectory(filename))
|
||||
if (IsBluRayDirectory(child.FullName, filename, directoryService))
|
||||
{
|
||||
var movie = new T
|
||||
{
|
||||
@@ -446,15 +446,14 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
|
||||
var subfolders = subFileEntries
|
||||
.Where(e => e.IsDirectory)
|
||||
.Select(d => d.Name)
|
||||
.ToList();
|
||||
|
||||
if (subfolders.Any(IsDvdDirectory))
|
||||
if (subfolders.Any(s => IsDvdDirectory(s.FullName, s.Name, directoryService)))
|
||||
{
|
||||
videoTypes.Add(VideoType.Dvd);
|
||||
return true;
|
||||
}
|
||||
if (subfolders.Any(IsBluRayDirectory))
|
||||
if (subfolders.Any(s => IsBluRayDirectory(s.FullName, s.Name, directoryService)))
|
||||
{
|
||||
videoTypes.Add(VideoType.BluRay);
|
||||
return true;
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.News
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
||||
while (!reader.EOF)
|
||||
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
@@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.News
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
||||
while (!reader.EOF)
|
||||
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
@@ -199,7 +199,7 @@ namespace Emby.Server.Implementations.News
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
||||
while (!reader.EOF)
|
||||
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user