mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 22:08:27 +01:00
Fixed a file system issue and also added a few more performance tweaks
This commit is contained in:
parent
906ad3cb1a
commit
e6a95defc9
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Events
|
||||
{
|
||||
@@ -15,15 +15,17 @@ namespace MediaBrowser.Controller.Events
|
||||
|
||||
public KeyValuePair<string, WIN32_FIND_DATA>? GetFileSystemEntry(string path, bool? isFolder)
|
||||
{
|
||||
foreach (KeyValuePair<string, WIN32_FIND_DATA> entry in FileSystemChildren)
|
||||
for (int i = 0; i < FileSystemChildren.Length; i++)
|
||||
{
|
||||
KeyValuePair<string, WIN32_FIND_DATA> entry = FileSystemChildren[i];
|
||||
|
||||
if (isFolder.HasValue)
|
||||
{
|
||||
if (isFolder.Value && entry.Value.IsDirectory)
|
||||
if (isFolder.Value && !entry.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (!isFolder.Value && !entry.Value.IsDirectory)
|
||||
else if (!isFolder.Value && entry.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -40,15 +42,17 @@ namespace MediaBrowser.Controller.Events
|
||||
|
||||
public KeyValuePair<string, WIN32_FIND_DATA>? GetFileSystemEntryByName(string name, bool? isFolder)
|
||||
{
|
||||
foreach (KeyValuePair<string, WIN32_FIND_DATA> entry in FileSystemChildren)
|
||||
for (int i = 0; i < FileSystemChildren.Length; i++)
|
||||
{
|
||||
KeyValuePair<string, WIN32_FIND_DATA> entry = FileSystemChildren[i];
|
||||
|
||||
if (isFolder.HasValue)
|
||||
{
|
||||
if (isFolder.Value && entry.Value.IsDirectory)
|
||||
if (isFolder.Value && !entry.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (!isFolder.Value && !entry.Value.IsDirectory)
|
||||
else if (!isFolder.Value && entry.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
@@ -48,8 +46,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// </summary>
|
||||
private void PopulateImages(BaseEntity item, ItemResolveEventArgs args)
|
||||
{
|
||||
foreach (KeyValuePair<string, WIN32_FIND_DATA> file in args.FileSystemChildren)
|
||||
for (int i = 0; i < args.FileSystemChildren.Length; i++)
|
||||
{
|
||||
var file = args.FileSystemChildren[i];
|
||||
|
||||
if (file.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
@@ -81,8 +81,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
List<string> backdropFiles = new List<string>();
|
||||
|
||||
foreach (KeyValuePair<string, WIN32_FIND_DATA> file in args.FileSystemChildren)
|
||||
for (int i = 0; i < args.FileSystemChildren.Length; i++)
|
||||
{
|
||||
var file = args.FileSystemChildren[i];
|
||||
|
||||
if (file.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
@@ -126,7 +128,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
}
|
||||
|
||||
if (backdropFiles.Any())
|
||||
if (backdropFiles.Count > 0)
|
||||
{
|
||||
item.BackdropImagePaths = backdropFiles;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
List<Video> localTrailers = new List<Video>();
|
||||
|
||||
foreach (string file in allFiles)
|
||||
for (int i = 0; i < allFiles.Length; i++)
|
||||
{
|
||||
string file = allFiles[i];
|
||||
|
||||
BaseItem child = await Kernel.Instance.ItemController.GetItem(file).ConfigureAwait(false);
|
||||
|
||||
Video video = child as Video;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using MediaBrowser.Controller.Events;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
@@ -51,8 +49,10 @@ namespace MediaBrowser.Controller.Resolvers
|
||||
}
|
||||
|
||||
// Also check the subfolders for bluray or dvd
|
||||
foreach (KeyValuePair<string, WIN32_FIND_DATA> folder in args.FileSystemChildren)
|
||||
for (int i = 0; i < args.FileSystemChildren.Length; i++)
|
||||
{
|
||||
var folder = args.FileSystemChildren[i];
|
||||
|
||||
if (!folder.Value.IsDirectory)
|
||||
{
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user