mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 22:38:30 +01:00
3.2.9.1
This commit is contained in:
@@ -151,8 +151,7 @@ namespace Emby.Server.Implementations.FileOrganization
|
||||
/// <param name="extensions">The extensions.</param>
|
||||
private void DeleteLeftOverFiles(string path, IEnumerable<string> extensions)
|
||||
{
|
||||
var eligibleFiles = _fileSystem.GetFiles(path, true)
|
||||
.Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
||||
var eligibleFiles = _fileSystem.GetFiles(path, extensions.ToArray(), false, true)
|
||||
.ToList();
|
||||
|
||||
foreach (var file in eligibleFiles)
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
await parent.ValidateChildren(new Progress<double>(), CancellationToken.None, new MetadataRefreshOptions(_fileSystem), false) .ConfigureAwait(false);
|
||||
await parent.ValidateChildren(new Progress<double>(), CancellationToken.None, new MetadataRefreshOptions(_fileSystem), false).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
else if (parent != null)
|
||||
@@ -941,7 +941,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return CreateItemByName<MusicArtist>(MusicArtist.GetPath, name);
|
||||
}
|
||||
|
||||
private T CreateItemByName<T>(Func<string,string> getPathFn, string name)
|
||||
private T CreateItemByName<T>(Func<string, string> getPathFn, string name)
|
||||
where T : BaseItem, new()
|
||||
{
|
||||
if (typeof(T) == typeof(MusicArtist))
|
||||
@@ -1255,8 +1255,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private string GetCollectionType(string path)
|
||||
{
|
||||
return _fileSystem.GetFiles(path, false)
|
||||
.Where(i => string.Equals(i.Extension, ".collection", StringComparison.OrdinalIgnoreCase))
|
||||
return _fileSystem.GetFiles(path, new[] { ".collection" }, true, false)
|
||||
.Select(i => _fileSystem.GetFileNameWithoutExtension(i))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
@@ -2474,29 +2473,36 @@ namespace Emby.Server.Implementations.Library
|
||||
return GetNamingOptions(new LibraryOptions());
|
||||
}
|
||||
|
||||
private NamingOptions _namingOptions;
|
||||
private string[] _videoFileExtensions;
|
||||
public NamingOptions GetNamingOptions(LibraryOptions libraryOptions)
|
||||
{
|
||||
var options = new ExtendedNamingOptions();
|
||||
|
||||
// These cause apps to have problems
|
||||
options.AudioFileExtensions.Remove(".m3u");
|
||||
options.AudioFileExtensions.Remove(".wpl");
|
||||
|
||||
if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
if (_namingOptions == null)
|
||||
{
|
||||
options.AudioFileExtensions.Remove(".rar");
|
||||
options.AudioFileExtensions.Remove(".zip");
|
||||
var options = new ExtendedNamingOptions();
|
||||
|
||||
// These cause apps to have problems
|
||||
options.AudioFileExtensions.Remove(".m3u");
|
||||
options.AudioFileExtensions.Remove(".wpl");
|
||||
|
||||
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.AudioFileExtensions.Remove(".rar");
|
||||
options.AudioFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.VideoFileExtensions.Remove(".rar");
|
||||
options.VideoFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
options.VideoFileExtensions.Add(".tp");
|
||||
_namingOptions = options;
|
||||
_videoFileExtensions = _namingOptions.VideoFileExtensions.ToArray();
|
||||
}
|
||||
|
||||
if (!libraryOptions.EnableArchiveMediaFiles)
|
||||
{
|
||||
options.VideoFileExtensions.Remove(".rar");
|
||||
options.VideoFileExtensions.Remove(".zip");
|
||||
}
|
||||
|
||||
options.VideoFileExtensions.Add(".tp");
|
||||
|
||||
return options;
|
||||
return _namingOptions;
|
||||
}
|
||||
|
||||
public ItemLookupInfo ParseName(string name)
|
||||
@@ -2515,12 +2521,14 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
public IEnumerable<Video> FindTrailers(BaseItem owner, List<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
||||
{
|
||||
var namingOptions = GetNamingOptions();
|
||||
|
||||
var files = owner.DetectIsInMixedFolder() ? new List<FileSystemMetadata>() : fileSystemChildren.Where(i => i.IsDirectory)
|
||||
.Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
||||
.SelectMany(i => _fileSystem.GetFiles(i.FullName, false))
|
||||
.SelectMany(i => _fileSystem.GetFiles(i.FullName, _videoFileExtensions, false, false))
|
||||
.ToList();
|
||||
|
||||
var videoListResolver = new VideoListResolver(GetNamingOptions(), new NullLogger());
|
||||
var videoListResolver = new VideoListResolver(namingOptions, new NullLogger());
|
||||
|
||||
var videos = videoListResolver.Resolve(fileSystemChildren);
|
||||
|
||||
@@ -2561,12 +2569,14 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
public IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
||||
{
|
||||
var namingOptions = GetNamingOptions();
|
||||
|
||||
var files = fileSystemChildren.Where(i => i.IsDirectory)
|
||||
.Where(i => ExtrasSubfolderNames.Contains(i.Name ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||
.SelectMany(i => _fileSystem.GetFiles(i.FullName, false))
|
||||
.SelectMany(i => _fileSystem.GetFiles(i.FullName, _videoFileExtensions, false, false))
|
||||
.ToList();
|
||||
|
||||
var videoListResolver = new VideoListResolver(GetNamingOptions(), new NullLogger());
|
||||
var videoListResolver = new VideoListResolver(namingOptions, new NullLogger());
|
||||
|
||||
var videos = videoListResolver.Resolve(fileSystemChildren);
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
return false;
|
||||
}
|
||||
|
||||
return directoryService.GetFiles(fullPath).Any(i => string.Equals(i.Extension, ".vob", StringComparison.OrdinalIgnoreCase));
|
||||
return directoryService.GetFilePaths(fullPath).Any(i => string.Equals(Path.GetExtension(i), ".vob", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,10 +5,6 @@ using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
|
||||
namespace Emby.Server.Implementations.Library.Resolvers
|
||||
@@ -45,7 +41,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
var filename = Path.GetFileNameWithoutExtension(args.Path);
|
||||
|
||||
// Make sure the image doesn't belong to a video file
|
||||
if (args.DirectoryService.GetFiles(Path.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename)))
|
||||
if (args.DirectoryService.GetFilePaths(Path.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -61,11 +57,14 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
return null;
|
||||
}
|
||||
|
||||
private bool IsOwnedByMedia(LibraryOptions libraryOptions, FileSystemMetadata file, string imageFilename)
|
||||
private bool IsOwnedByMedia(LibraryOptions libraryOptions, string file, string imageFilename)
|
||||
{
|
||||
if (_libraryManager.IsVideoFile(file.FullName, libraryOptions) && imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file.Name), StringComparison.OrdinalIgnoreCase))
|
||||
if (_libraryManager.IsVideoFile(file, libraryOptions))
|
||||
{
|
||||
return true;
|
||||
if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user