commit
cae9dfc1c9
|
@ -206,7 +206,7 @@ namespace BDInfo
|
||||||
|
|
||||||
private IEnumerable<FileSystemMetadata> GetFiles(string path, string extension)
|
private IEnumerable<FileSystemMetadata> GetFiles(string path, string extension)
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFiles(path).Where(i => string.Equals(i.Extension, extension, StringComparison.OrdinalIgnoreCase));
|
return _fileSystem.GetFiles(path, new[] { extension }, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Scan()
|
public void Scan()
|
||||||
|
|
|
@ -657,14 +657,41 @@ namespace Emby.Common.Implementations.IO
|
||||||
{
|
{
|
||||||
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
||||||
|
|
||||||
return ToMetadata(path, new DirectoryInfo(path).EnumerateDirectories("*", searchOption));
|
return ToMetadata(new DirectoryInfo(path).EnumerateDirectories("*", searchOption));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false)
|
public IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false)
|
||||||
|
{
|
||||||
|
return GetFiles(path, null, true, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<FileSystemMetadata> GetFiles(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive = false)
|
||||||
{
|
{
|
||||||
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
||||||
|
|
||||||
return ToMetadata(path, new DirectoryInfo(path).EnumerateFiles("*", searchOption));
|
// On linux and osx the search pattern is case sensitive
|
||||||
|
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
|
||||||
|
if (enableCaseSensitiveExtensions && extensions != null && extensions.Length == 1)
|
||||||
|
{
|
||||||
|
return ToMetadata(new DirectoryInfo(path).EnumerateFiles("*" + extensions[0], searchOption));
|
||||||
|
}
|
||||||
|
|
||||||
|
var files = new DirectoryInfo(path).EnumerateFiles("*", searchOption);
|
||||||
|
|
||||||
|
if (extensions != null && extensions.Length > 0)
|
||||||
|
{
|
||||||
|
files = files.Where(i =>
|
||||||
|
{
|
||||||
|
var ext = i.Extension;
|
||||||
|
if (ext == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return extensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToMetadata(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false)
|
public IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false)
|
||||||
|
@ -674,14 +701,14 @@ namespace Emby.Common.Implementations.IO
|
||||||
|
|
||||||
if (EnableFileSystemRequestConcat)
|
if (EnableFileSystemRequestConcat)
|
||||||
{
|
{
|
||||||
return ToMetadata(path, directoryInfo.EnumerateDirectories("*", searchOption))
|
return ToMetadata(directoryInfo.EnumerateDirectories("*", searchOption))
|
||||||
.Concat(ToMetadata(path, directoryInfo.EnumerateFiles("*", searchOption)));
|
.Concat(ToMetadata(directoryInfo.EnumerateFiles("*", searchOption)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ToMetadata(path, directoryInfo.EnumerateFileSystemInfos("*", searchOption));
|
return ToMetadata(directoryInfo.EnumerateFileSystemInfos("*", searchOption));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<FileSystemMetadata> ToMetadata(string parentPath, IEnumerable<FileSystemInfo> infos)
|
private IEnumerable<FileSystemMetadata> ToMetadata(IEnumerable<FileSystemInfo> infos)
|
||||||
{
|
{
|
||||||
return infos.Select(GetFileSystemMetadata);
|
return infos.Select(GetFileSystemMetadata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,19 +286,12 @@ namespace Emby.Dlna
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var allFiles = _fileSystem.GetFiles(path)
|
var xmlFies = _fileSystem.GetFilePaths(path)
|
||||||
|
.Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var xmlFies = allFiles
|
return xmlFies
|
||||||
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
|
.Select(i => ParseProfileFile(i, type))
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var parseFiles = new List<FileSystemMetadata>();
|
|
||||||
|
|
||||||
parseFiles.AddRange(xmlFies);
|
|
||||||
|
|
||||||
return parseFiles
|
|
||||||
.Select(i => ParseProfileFile(i.FullName, type))
|
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -322,16 +315,9 @@ namespace Emby.Dlna
|
||||||
{
|
{
|
||||||
DeviceProfile profile;
|
DeviceProfile profile;
|
||||||
|
|
||||||
if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
var tempProfile = (DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(DeviceProfile), path);
|
var tempProfile = (DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(DeviceProfile), path);
|
||||||
|
|
||||||
profile = ReserializeProfile(tempProfile);
|
profile = ReserializeProfile(tempProfile);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
profile = (DeviceProfile)_jsonSerializer.DeserializeFromFile(typeof(DeviceProfile), path);
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.Id = path.ToLower().GetMD5().ToString("N");
|
profile.Id = path.ToLower().GetMD5().ToString("N");
|
||||||
profile.ProfileType = type;
|
profile.ProfileType = type;
|
||||||
|
@ -553,15 +539,13 @@ namespace Emby.Dlna
|
||||||
class DlnaProfileEntryPoint : IServerEntryPoint
|
class DlnaProfileEntryPoint : IServerEntryPoint
|
||||||
{
|
{
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IXmlSerializer _xmlSerializer;
|
private readonly IXmlSerializer _xmlSerializer;
|
||||||
|
|
||||||
public DlnaProfileEntryPoint(IApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer)
|
public DlnaProfileEntryPoint(IApplicationPaths appPaths, IFileSystem fileSystem, IXmlSerializer xmlSerializer)
|
||||||
{
|
{
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_jsonSerializer = jsonSerializer;
|
|
||||||
_xmlSerializer = xmlSerializer;
|
_xmlSerializer = xmlSerializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,8 +151,7 @@ namespace Emby.Server.Implementations.FileOrganization
|
||||||
/// <param name="extensions">The extensions.</param>
|
/// <param name="extensions">The extensions.</param>
|
||||||
private void DeleteLeftOverFiles(string path, IEnumerable<string> extensions)
|
private void DeleteLeftOverFiles(string path, IEnumerable<string> extensions)
|
||||||
{
|
{
|
||||||
var eligibleFiles = _fileSystem.GetFiles(path, true)
|
var eligibleFiles = _fileSystem.GetFiles(path, extensions.ToArray(), false, true)
|
||||||
.Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var file in eligibleFiles)
|
foreach (var file in eligibleFiles)
|
||||||
|
|
|
@ -448,7 +448,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (parent != null)
|
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)
|
else if (parent != null)
|
||||||
|
@ -941,7 +941,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
return CreateItemByName<MusicArtist>(MusicArtist.GetPath, name);
|
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()
|
where T : BaseItem, new()
|
||||||
{
|
{
|
||||||
if (typeof(T) == typeof(MusicArtist))
|
if (typeof(T) == typeof(MusicArtist))
|
||||||
|
@ -1255,8 +1255,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private string GetCollectionType(string path)
|
private string GetCollectionType(string path)
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFiles(path, false)
|
return _fileSystem.GetFiles(path, new[] { ".collection" }, true, false)
|
||||||
.Where(i => string.Equals(i.Extension, ".collection", StringComparison.OrdinalIgnoreCase))
|
|
||||||
.Select(i => _fileSystem.GetFileNameWithoutExtension(i))
|
.Select(i => _fileSystem.GetFileNameWithoutExtension(i))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
@ -2474,7 +2473,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
return GetNamingOptions(new LibraryOptions());
|
return GetNamingOptions(new LibraryOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NamingOptions _namingOptions;
|
||||||
|
private string[] _videoFileExtensions;
|
||||||
public NamingOptions GetNamingOptions(LibraryOptions libraryOptions)
|
public NamingOptions GetNamingOptions(LibraryOptions libraryOptions)
|
||||||
|
{
|
||||||
|
if (_namingOptions == null)
|
||||||
{
|
{
|
||||||
var options = new ExtendedNamingOptions();
|
var options = new ExtendedNamingOptions();
|
||||||
|
|
||||||
|
@ -2482,21 +2485,24 @@ namespace Emby.Server.Implementations.Library
|
||||||
options.AudioFileExtensions.Remove(".m3u");
|
options.AudioFileExtensions.Remove(".m3u");
|
||||||
options.AudioFileExtensions.Remove(".wpl");
|
options.AudioFileExtensions.Remove(".wpl");
|
||||||
|
|
||||||
if (!libraryOptions.EnableArchiveMediaFiles)
|
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||||
{
|
{
|
||||||
options.AudioFileExtensions.Remove(".rar");
|
options.AudioFileExtensions.Remove(".rar");
|
||||||
options.AudioFileExtensions.Remove(".zip");
|
options.AudioFileExtensions.Remove(".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!libraryOptions.EnableArchiveMediaFiles)
|
//if (!libraryOptions.EnableArchiveMediaFiles)
|
||||||
{
|
{
|
||||||
options.VideoFileExtensions.Remove(".rar");
|
options.VideoFileExtensions.Remove(".rar");
|
||||||
options.VideoFileExtensions.Remove(".zip");
|
options.VideoFileExtensions.Remove(".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
options.VideoFileExtensions.Add(".tp");
|
options.VideoFileExtensions.Add(".tp");
|
||||||
|
_namingOptions = options;
|
||||||
|
_videoFileExtensions = _namingOptions.VideoFileExtensions.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return _namingOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemLookupInfo ParseName(string name)
|
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)
|
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)
|
var files = owner.DetectIsInMixedFolder() ? new List<FileSystemMetadata>() : fileSystemChildren.Where(i => i.IsDirectory)
|
||||||
.Where(i => string.Equals(i.Name, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase))
|
.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();
|
.ToList();
|
||||||
|
|
||||||
var videoListResolver = new VideoListResolver(GetNamingOptions(), new NullLogger());
|
var videoListResolver = new VideoListResolver(namingOptions, new NullLogger());
|
||||||
|
|
||||||
var videos = videoListResolver.Resolve(fileSystemChildren);
|
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)
|
public IEnumerable<Video> FindExtras(BaseItem owner, List<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
|
var namingOptions = GetNamingOptions();
|
||||||
|
|
||||||
var files = fileSystemChildren.Where(i => i.IsDirectory)
|
var files = fileSystemChildren.Where(i => i.IsDirectory)
|
||||||
.Where(i => ExtrasSubfolderNames.Contains(i.Name ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
.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();
|
.ToList();
|
||||||
|
|
||||||
var videoListResolver = new VideoListResolver(GetNamingOptions(), new NullLogger());
|
var videoListResolver = new VideoListResolver(namingOptions, new NullLogger());
|
||||||
|
|
||||||
var videos = videoListResolver.Resolve(fileSystemChildren);
|
var videos = videoListResolver.Resolve(fileSystemChildren);
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
return false;
|
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>
|
/// <summary>
|
||||||
|
|
|
@ -5,10 +5,6 @@ using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Model.IO;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
|
||||||
using MediaBrowser.Controller.IO;
|
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Resolvers
|
namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
|
@ -45,7 +41,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
var filename = Path.GetFileNameWithoutExtension(args.Path);
|
var filename = Path.GetFileNameWithoutExtension(args.Path);
|
||||||
|
|
||||||
// Make sure the image doesn't belong to a video file
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -61,12 +57,15 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
return null;
|
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))
|
||||||
|
{
|
||||||
|
if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,8 +135,7 @@ namespace MediaBrowser.Api.Images
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return _fileSystem.GetFiles(path, true)
|
return _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, true)
|
||||||
.Where(i => BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.Ordinal))
|
|
||||||
.Select(i => new ImageByNameInfo
|
.Select(i => new ImageByNameInfo
|
||||||
{
|
{
|
||||||
Name = _fileSystem.GetFileNameWithoutExtension(i),
|
Name = _fileSystem.GetFileNameWithoutExtension(i),
|
||||||
|
|
|
@ -345,34 +345,34 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
|
|
||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
DeleteFile(file, retryCount);
|
DeleteFile(file.FullName, retryCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteFile(FileSystemMetadata file, int retryCount)
|
private void DeleteFile(string path, int retryCount)
|
||||||
{
|
{
|
||||||
if (retryCount >= 5)
|
if (retryCount >= 5)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug("Deleting partial HLS file {0}", file.FullName);
|
Logger.Debug("Deleting partial HLS file {0}", path);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileSystem.DeleteFile(file.FullName);
|
FileSystem.DeleteFile(path);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, file.FullName);
|
Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
|
|
||||||
var task = Task.Delay(100);
|
var task = Task.Delay(100);
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
DeleteFile(file, retryCount + 1);
|
DeleteFile(path, retryCount + 1);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, file.FullName);
|
Logger.ErrorException("Error deleting partial stream file(s) {0}", ex, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,8 +384,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return fileSystem.GetFiles(folder)
|
return fileSystem.GetFiles(folder, new[] { segmentExtension }, true, false)
|
||||||
.Where(i => string.Equals(i.Extension, segmentExtension, StringComparison.OrdinalIgnoreCase) && Path.GetFileNameWithoutExtension(i.Name).StartsWith(filePrefix, StringComparison.OrdinalIgnoreCase))
|
.Where(i => Path.GetFileNameWithoutExtension(i.Name).StartsWith(filePrefix, StringComparison.OrdinalIgnoreCase))
|
||||||
.OrderByDescending(fileSystem.GetLastWriteTimeUtc)
|
.OrderByDescending(fileSystem.GetLastWriteTimeUtc)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
config.EnableStandaloneMusicKeys = true;
|
config.EnableStandaloneMusicKeys = true;
|
||||||
config.EnableCaseSensitiveItemIds = true;
|
config.EnableCaseSensitiveItemIds = true;
|
||||||
config.EnableFolderView = true;
|
|
||||||
config.SkipDeserializationForBasicTypes = true;
|
config.SkipDeserializationForBasicTypes = true;
|
||||||
config.SkipDeserializationForPrograms = true;
|
config.SkipDeserializationForPrograms = true;
|
||||||
config.SkipDeserializationForAudio = true;
|
config.SkipDeserializationForAudio = true;
|
||||||
|
|
|
@ -122,8 +122,7 @@ namespace MediaBrowser.Api.System
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
files = _fileSystem.GetFiles(_appPaths.LogDirectoryPath)
|
files = _fileSystem.GetFiles(_appPaths.LogDirectoryPath, new[] { ".txt" }, true, false)
|
||||||
.Where(i => string.Equals(i.Extension, ".txt", StringComparison.OrdinalIgnoreCase))
|
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We don't support manual shortcuts
|
/// We don't support manual shortcuts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[IgnoreDataMember]
|
||||||
protected override bool SupportsShortcutChildren
|
protected override bool SupportsShortcutChildren
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -1926,8 +1926,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
.Where(i => i.IsLocalFile)
|
.Where(i => i.IsLocalFile)
|
||||||
.Select(i => System.IO.Path.GetDirectoryName(i.Path))
|
.Select(i => System.IO.Path.GetDirectoryName(i.Path))
|
||||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
.SelectMany(directoryService.GetFiles)
|
.SelectMany(directoryService.GetFilePaths)
|
||||||
.Select(i => i.FullName)
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var deletedImages = ImageInfos
|
var deletedImages = ImageInfos
|
||||||
|
@ -2100,8 +2099,8 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList();
|
var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList();
|
||||||
extensions.AddRange(SupportedImageExtensionsList);
|
extensions.AddRange(SupportedImageExtensionsList);
|
||||||
|
|
||||||
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path))
|
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false)
|
||||||
.Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase) && System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
|
.Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1713,13 +1713,13 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
return "-c:v h264_qsv ";
|
return "-c:v h264_qsv ";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//case "hevc":
|
case "hevc":
|
||||||
//case "h265":
|
case "h265":
|
||||||
// if (_mediaEncoder.SupportsDecoder("hevc_qsv"))
|
if (_mediaEncoder.SupportsDecoder("hevc_qsv"))
|
||||||
// {
|
{
|
||||||
// return "-c:v hevc_qsv ";
|
return "-c:v hevc_qsv ";
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
case "mpeg2video":
|
case "mpeg2video":
|
||||||
if (_mediaEncoder.SupportsDecoder("mpeg2_qsv"))
|
if (_mediaEncoder.SupportsDecoder("mpeg2_qsv"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,16 @@ namespace MediaBrowser.Controller.Providers
|
||||||
return GetFileSystemEntries(path, clearCache).Where(i => !i.IsDirectory);
|
return GetFileSystemEntries(path, clearCache).Where(i => !i.IsDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetFilePaths(string path)
|
||||||
|
{
|
||||||
|
return _fileSystem.GetFilePaths(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetFilePaths(string path, bool clearCache)
|
||||||
|
{
|
||||||
|
return _fileSystem.GetFilePaths(path);
|
||||||
|
}
|
||||||
|
|
||||||
public FileSystemMetadata GetFile(string path)
|
public FileSystemMetadata GetFile(string path)
|
||||||
{
|
{
|
||||||
FileSystemMetadata file;
|
FileSystemMetadata file;
|
||||||
|
|
|
@ -8,9 +8,10 @@ namespace MediaBrowser.Controller.Providers
|
||||||
public interface IDirectoryService
|
public interface IDirectoryService
|
||||||
{
|
{
|
||||||
IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path);
|
IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path);
|
||||||
IEnumerable<FileSystemMetadata> GetFiles(string path);
|
|
||||||
IEnumerable<FileSystemMetadata> GetDirectories(string path);
|
IEnumerable<FileSystemMetadata> GetDirectories(string path);
|
||||||
IEnumerable<FileSystemMetadata> GetFiles(string path, bool clearCache);
|
IEnumerable<FileSystemMetadata> GetFiles(string path);
|
||||||
|
IEnumerable<string> GetFilePaths(string path);
|
||||||
|
IEnumerable<string> GetFilePaths(string path, bool clearCache);
|
||||||
FileSystemMetadata GetFile(string path);
|
FileSystemMetadata GetFile(string path);
|
||||||
Dictionary<string, FileSystemMetadata> GetFileSystemDictionary(string path);
|
Dictionary<string, FileSystemMetadata> GetFileSystemDictionary(string path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
{
|
{
|
||||||
var collectionFolder = (CollectionFolder)item;
|
var collectionFolder = (CollectionFolder)item;
|
||||||
|
|
||||||
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, directoryService);
|
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, true, directoryService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
|
|
||||||
if (parentPathFiles.Any(i => string.Equals(i.FullName, metadataPath, StringComparison.OrdinalIgnoreCase)))
|
if (parentPathFiles.Any(i => string.Equals(i.FullName, metadataPath, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
return GetFilesFromParentFolder(nameWithoutExtension, directoryService.GetFiles(metadataPath));
|
var filesInMetadataFolder = _fileSystem.GetFiles(metadataPath, BaseItem.SupportedImageExtensions, false, false);
|
||||||
|
return GetFilesFromParentFolder(nameWithoutExtension, filesInMetadataFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<LocalImageInfo>();
|
return new List<LocalImageInfo>();
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new LocalImageProvider(_fileSystem).GetImages(item, path, directoryService);
|
return new LocalImageProvider(_fileSystem).GetImages(item, path, false, directoryService);
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return new LocalImageProvider(_fileSystem).GetImages(item, path, directoryService);
|
return new LocalImageProvider(_fileSystem).GetImages(item, path, false, directoryService);
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,27 +96,37 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LocalImageInfo> GetImages(IHasImages item, string path, IDirectoryService directoryService)
|
public List<LocalImageInfo> GetImages(IHasImages item, string path, bool isPathInMediaFolder, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
return GetImages(item, new[] { path }, directoryService);
|
return GetImages(item, new[] { path }, isPathInMediaFolder, directoryService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LocalImageInfo> GetImages(IHasImages item, IEnumerable<string> paths, IDirectoryService directoryService)
|
public List<LocalImageInfo> GetImages(IHasImages item, IEnumerable<string> paths, bool arePathsInMediaFolders, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var files = paths.SelectMany(directoryService.GetFiles)
|
IEnumerable<FileSystemMetadata> files;
|
||||||
|
|
||||||
|
if (arePathsInMediaFolders)
|
||||||
|
{
|
||||||
|
files = paths.SelectMany(i => _fileSystem.GetFiles(i, BaseItem.SupportedImageExtensions, true, false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
files = paths.SelectMany(directoryService.GetFiles)
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
{
|
{
|
||||||
var ext = i.Extension;
|
var ext = i.Extension;
|
||||||
|
|
||||||
return !string.IsNullOrEmpty(ext) &&
|
return !string.IsNullOrEmpty(ext) &&
|
||||||
BaseItem.SupportedImageExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
|
BaseItem.SupportedImageExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
|
||||||
})
|
});
|
||||||
.OrderBy(i => BaseItem.SupportedImageExtensionsList.IndexOf(i.Extension ?? string.Empty))
|
}
|
||||||
.ToList();
|
|
||||||
|
files = files
|
||||||
|
.OrderBy(i => BaseItem.SupportedImageExtensionsList.IndexOf(i.Extension ?? string.Empty));
|
||||||
|
|
||||||
var list = new List<LocalImageInfo>();
|
var list = new List<LocalImageInfo>();
|
||||||
|
|
||||||
PopulateImages(item, list, files, false, directoryService);
|
PopulateImages(item, list, files.ToList(), false, directoryService);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -256,18 +266,7 @@ namespace MediaBrowser.LocalMetadata.Images
|
||||||
|
|
||||||
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images, IDirectoryService directoryService)
|
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var imageFiles = directoryService.GetFiles(path)
|
var imageFiles = _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, false);
|
||||||
.Where(i =>
|
|
||||||
{
|
|
||||||
var extension = i.Extension;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(extension))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return BaseItem.SupportedImageExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
|
|
||||||
});
|
|
||||||
|
|
||||||
images.AddRange(imageFiles.Select(i => new LocalImageInfo
|
images.AddRange(imageFiles.Select(i => new LocalImageInfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -223,7 +223,6 @@ namespace MediaBrowser.Model.Configuration
|
||||||
EnableAnonymousUsageReporting = true;
|
EnableAnonymousUsageReporting = true;
|
||||||
|
|
||||||
EnableAutomaticRestart = true;
|
EnableAutomaticRestart = true;
|
||||||
EnableFolderView = true;
|
|
||||||
|
|
||||||
EnableUPnP = true;
|
EnableUPnP = true;
|
||||||
SharingExpirationDays = 30;
|
SharingExpirationDays = 30;
|
||||||
|
|
|
@ -191,11 +191,10 @@ namespace MediaBrowser.Model.IO
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the files.
|
/// Gets the files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
|
||||||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
|
||||||
/// <returns>IEnumerable<FileInfo>.</returns>
|
|
||||||
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
|
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
|
||||||
|
|
||||||
|
IEnumerable<FileSystemMetadata> GetFiles(string path, string [] extensions, bool enableCaseSensitiveExtensions, bool recursive);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the file system entries.
|
/// Gets the file system entries.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -199,7 +199,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
return !video.SubtitleFiles
|
return !video.SubtitleFiles
|
||||||
.SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, directoryService, _fileSystem, false)
|
.SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, directoryService, _fileSystem, false)
|
||||||
.Select(i => i.FullName)
|
|
||||||
.OrderBy(i => i), StringComparer.OrdinalIgnoreCase);
|
.OrderBy(i => i), StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,8 +662,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
|
|
||||||
// Try to eliminate menus and intros by skipping all files at the front of the list that are less than the minimum size
|
// Try to eliminate menus and intros by skipping all files at the front of the list that are less than the minimum size
|
||||||
// Once we reach a file that is at least the minimum, return all subsequent ones
|
// Once we reach a file that is at least the minimum, return all subsequent ones
|
||||||
var allVobs = _fileSystem.GetFiles(root, true)
|
var allVobs = _fileSystem.GetFiles(root, new[] { ".vob" }, false, true)
|
||||||
.Where(file => string.Equals(file.Extension, ".vob", StringComparison.OrdinalIgnoreCase))
|
|
||||||
.OrderBy(i => i.FullName)
|
.OrderBy(i => i.FullName)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.IO;
|
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
|
||||||
|
@ -36,11 +34,9 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
var videoFileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(video.Path);
|
var videoFileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(video.Path);
|
||||||
videoFileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(videoFileNameWithoutExtension);
|
videoFileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(videoFileNameWithoutExtension);
|
||||||
|
|
||||||
foreach (var file in files)
|
foreach (var fullName in files)
|
||||||
{
|
{
|
||||||
var fullName = file.FullName;
|
var fileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(fullName);
|
||||||
|
|
||||||
var fileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(file);
|
|
||||||
fileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(fileNameWithoutExtension);
|
fileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(fileNameWithoutExtension);
|
||||||
|
|
||||||
var codec = Path.GetExtension(fullName).ToLower().TrimStart('.');
|
var codec = Path.GetExtension(fullName).ToLower().TrimStart('.');
|
||||||
|
@ -128,7 +124,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<FileSystemMetadata> GetSubtitleFiles(Video video, IDirectoryService directoryService, IFileSystem fileSystem, bool clearCache)
|
public static IEnumerable<string> GetSubtitleFiles(Video video, IDirectoryService directoryService, IFileSystem fileSystem, bool clearCache)
|
||||||
{
|
{
|
||||||
var containingPath = video.ContainingFolderPath;
|
var containingPath = video.ContainingFolderPath;
|
||||||
|
|
||||||
|
@ -137,14 +133,15 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
throw new ArgumentException(string.Format("Cannot search for items that don't have a path: {0} {1}", video.Name, video.Id));
|
throw new ArgumentException(string.Format("Cannot search for items that don't have a path: {0} {1}", video.Name, video.Id));
|
||||||
}
|
}
|
||||||
|
|
||||||
var files = directoryService.GetFiles(containingPath, clearCache);
|
var files = directoryService.GetFilePaths(containingPath, clearCache);
|
||||||
|
|
||||||
var videoFileNameWithoutExtension = fileSystem.GetFileNameWithoutExtension(video.Path);
|
var videoFileNameWithoutExtension = fileSystem.GetFileNameWithoutExtension(video.Path);
|
||||||
|
|
||||||
return files.Where(i =>
|
return files.Where(i =>
|
||||||
{
|
{
|
||||||
if (!i.IsDirectory &&
|
var extension = Path.GetExtension(i);
|
||||||
SubtitleExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
|
||||||
|
if (SubtitleExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var fileNameWithoutExtension = fileSystem.GetFileNameWithoutExtension(i);
|
var fileNameWithoutExtension = fileSystem.GetFileNameWithoutExtension(i);
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var files = _fileSystem.GetFiles(seriesDataPath)
|
var files = _fileSystem.GetFiles(seriesDataPath, new[] { ".xml" }, true, false)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var seriesXmlFilename = preferredMetadataLanguage + ".xml";
|
var seriesXmlFilename = preferredMetadataLanguage + ".xml";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user