Merge pull request #2555 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-03-29 02:27:52 -04:00 committed by GitHub
commit cae9dfc1c9
27 changed files with 166 additions and 146 deletions

View File

@ -206,7 +206,7 @@ namespace BDInfo
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()

View File

@ -657,14 +657,41 @@ namespace Emby.Common.Implementations.IO
{
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)
{
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;
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)
@ -674,14 +701,14 @@ namespace Emby.Common.Implementations.IO
if (EnableFileSystemRequestConcat)
{
return ToMetadata(path, directoryInfo.EnumerateDirectories("*", searchOption))
.Concat(ToMetadata(path, directoryInfo.EnumerateFiles("*", searchOption)));
return ToMetadata(directoryInfo.EnumerateDirectories("*", 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);
}

View File

@ -286,19 +286,12 @@ namespace Emby.Dlna
{
try
{
var allFiles = _fileSystem.GetFiles(path)
var xmlFies = _fileSystem.GetFilePaths(path)
.Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
.ToList();
var xmlFies = allFiles
.Where(i => string.Equals(i.Extension, ".xml", StringComparison.OrdinalIgnoreCase))
.ToList();
var parseFiles = new List<FileSystemMetadata>();
parseFiles.AddRange(xmlFies);
return parseFiles
.Select(i => ParseProfileFile(i.FullName, type))
return xmlFies
.Select(i => ParseProfileFile(i, type))
.Where(i => i != null)
.ToList();
}
@ -322,16 +315,9 @@ namespace Emby.Dlna
{
DeviceProfile profile;
if (string.Equals(Path.GetExtension(path), ".xml", StringComparison.OrdinalIgnoreCase))
{
var tempProfile = (DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(DeviceProfile), path);
profile = ReserializeProfile(tempProfile);
}
else
{
profile = (DeviceProfile)_jsonSerializer.DeserializeFromFile(typeof(DeviceProfile), path);
}
profile.Id = path.ToLower().GetMD5().ToString("N");
profile.ProfileType = type;
@ -553,15 +539,13 @@ namespace Emby.Dlna
class DlnaProfileEntryPoint : IServerEntryPoint
{
private readonly IApplicationPaths _appPaths;
private readonly IJsonSerializer _jsonSerializer;
private readonly IFileSystem _fileSystem;
private readonly IXmlSerializer _xmlSerializer;
public DlnaProfileEntryPoint(IApplicationPaths appPaths, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IXmlSerializer xmlSerializer)
public DlnaProfileEntryPoint(IApplicationPaths appPaths, IFileSystem fileSystem, IXmlSerializer xmlSerializer)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
_jsonSerializer = jsonSerializer;
_xmlSerializer = xmlSerializer;
}

View File

@ -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)

View File

@ -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,7 +2473,11 @@ namespace Emby.Server.Implementations.Library
return GetNamingOptions(new LibraryOptions());
}
private NamingOptions _namingOptions;
private string[] _videoFileExtensions;
public NamingOptions GetNamingOptions(LibraryOptions libraryOptions)
{
if (_namingOptions == null)
{
var options = new ExtendedNamingOptions();
@ -2482,21 +2485,24 @@ namespace Emby.Server.Implementations.Library
options.AudioFileExtensions.Remove(".m3u");
options.AudioFileExtensions.Remove(".wpl");
if (!libraryOptions.EnableArchiveMediaFiles)
//if (!libraryOptions.EnableArchiveMediaFiles)
{
options.AudioFileExtensions.Remove(".rar");
options.AudioFileExtensions.Remove(".zip");
}
if (!libraryOptions.EnableArchiveMediaFiles)
//if (!libraryOptions.EnableArchiveMediaFiles)
{
options.VideoFileExtensions.Remove(".rar");
options.VideoFileExtensions.Remove(".zip");
}
options.VideoFileExtensions.Add(".tp");
_namingOptions = options;
_videoFileExtensions = _namingOptions.VideoFileExtensions.ToArray();
}
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);

View File

@ -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>

View File

@ -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,12 +57,15 @@ 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))
{
if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}

View File

@ -135,8 +135,7 @@ namespace MediaBrowser.Api.Images
{
try
{
return _fileSystem.GetFiles(path, true)
.Where(i => BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.Ordinal))
return _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, true)
.Select(i => new ImageByNameInfo
{
Name = _fileSystem.GetFileNameWithoutExtension(i),

View File

@ -345,34 +345,34 @@ namespace MediaBrowser.Api.Playback.Hls
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)
{
return;
}
Logger.Debug("Deleting partial HLS file {0}", file.FullName);
Logger.Debug("Deleting partial HLS file {0}", path);
try
{
FileSystem.DeleteFile(file.FullName);
FileSystem.DeleteFile(path);
}
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);
Task.WaitAll(task);
DeleteFile(file, retryCount + 1);
DeleteFile(path, retryCount + 1);
}
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
{
return fileSystem.GetFiles(folder)
.Where(i => string.Equals(i.Extension, segmentExtension, StringComparison.OrdinalIgnoreCase) && Path.GetFileNameWithoutExtension(i.Name).StartsWith(filePrefix, StringComparison.OrdinalIgnoreCase))
return fileSystem.GetFiles(folder, new[] { segmentExtension }, true, false)
.Where(i => Path.GetFileNameWithoutExtension(i.Name).StartsWith(filePrefix, StringComparison.OrdinalIgnoreCase))
.OrderByDescending(fileSystem.GetLastWriteTimeUtc)
.FirstOrDefault();
}

View File

@ -94,7 +94,6 @@ namespace MediaBrowser.Api
{
config.EnableStandaloneMusicKeys = true;
config.EnableCaseSensitiveItemIds = true;
config.EnableFolderView = true;
config.SkipDeserializationForBasicTypes = true;
config.SkipDeserializationForPrograms = true;
config.SkipDeserializationForAudio = true;

View File

@ -122,8 +122,7 @@ namespace MediaBrowser.Api.System
try
{
files = _fileSystem.GetFiles(_appPaths.LogDirectoryPath)
.Where(i => string.Equals(i.Extension, ".txt", StringComparison.OrdinalIgnoreCase))
files = _fileSystem.GetFiles(_appPaths.LogDirectoryPath, new[] { ".txt" }, true, false)
.ToList();
}
catch (IOException)

View File

@ -27,6 +27,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// We don't support manual shortcuts
/// </summary>
[IgnoreDataMember]
protected override bool SupportsShortcutChildren
{
get

View File

@ -1926,8 +1926,7 @@ namespace MediaBrowser.Controller.Entities
.Where(i => i.IsLocalFile)
.Select(i => System.IO.Path.GetDirectoryName(i.Path))
.Distinct(StringComparer.OrdinalIgnoreCase)
.SelectMany(directoryService.GetFiles)
.Select(i => i.FullName)
.SelectMany(directoryService.GetFilePaths)
.ToList();
var deletedImages = ImageInfos
@ -2100,8 +2099,8 @@ namespace MediaBrowser.Controller.Entities
var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList();
extensions.AddRange(SupportedImageExtensionsList);
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path))
.Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase) && System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false)
.Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
.ToList();
}

View File

@ -1713,13 +1713,13 @@ namespace MediaBrowser.Controller.MediaEncoding
return "-c:v h264_qsv ";
}
break;
//case "hevc":
//case "h265":
// if (_mediaEncoder.SupportsDecoder("hevc_qsv"))
// {
// return "-c:v hevc_qsv ";
// }
// break;
case "hevc":
case "h265":
if (_mediaEncoder.SupportsDecoder("hevc_qsv"))
{
return "-c:v hevc_qsv ";
}
break;
case "mpeg2video":
if (_mediaEncoder.SupportsDecoder("mpeg2_qsv"))
{

View File

@ -103,6 +103,16 @@ namespace MediaBrowser.Controller.Providers
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)
{
FileSystemMetadata file;

View File

@ -8,9 +8,10 @@ namespace MediaBrowser.Controller.Providers
public interface IDirectoryService
{
IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path);
IEnumerable<FileSystemMetadata> GetFiles(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);
Dictionary<string, FileSystemMetadata> GetFileSystemDictionary(string path);
}

View File

@ -39,7 +39,7 @@ namespace MediaBrowser.LocalMetadata.Images
{
var collectionFolder = (CollectionFolder)item;
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, directoryService);
return new LocalImageProvider(_fileSystem).GetImages(item, collectionFolder.PhysicalLocations, true, directoryService);
}
}
}

View File

@ -56,7 +56,8 @@ namespace MediaBrowser.LocalMetadata.Images
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>();

View File

@ -47,7 +47,7 @@ namespace MediaBrowser.LocalMetadata.Images
try
{
return new LocalImageProvider(_fileSystem).GetImages(item, path, directoryService);
return new LocalImageProvider(_fileSystem).GetImages(item, path, false, directoryService);
}
catch (IOException)
{

View File

@ -67,7 +67,7 @@ namespace MediaBrowser.LocalMetadata.Images
try
{
return new LocalImageProvider(_fileSystem).GetImages(item, path, directoryService);
return new LocalImageProvider(_fileSystem).GetImages(item, path, false, directoryService);
}
catch (IOException)
{

View File

@ -96,27 +96,37 @@ namespace MediaBrowser.LocalMetadata.Images
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 =>
{
var ext = i.Extension;
return !string.IsNullOrEmpty(ext) &&
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>();
PopulateImages(item, list, files, false, directoryService);
PopulateImages(item, list, files.ToList(), false, directoryService);
return list;
}
@ -256,18 +266,7 @@ namespace MediaBrowser.LocalMetadata.Images
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images, IDirectoryService directoryService)
{
var imageFiles = directoryService.GetFiles(path)
.Where(i =>
{
var extension = i.Extension;
if (string.IsNullOrEmpty(extension))
{
return false;
}
return BaseItem.SupportedImageExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
});
var imageFiles = _fileSystem.GetFiles(path, BaseItem.SupportedImageExtensions, false, false);
images.AddRange(imageFiles.Select(i => new LocalImageInfo
{

View File

@ -223,7 +223,6 @@ namespace MediaBrowser.Model.Configuration
EnableAnonymousUsageReporting = true;
EnableAutomaticRestart = true;
EnableFolderView = true;
EnableUPnP = true;
SharingExpirationDays = 30;

View File

@ -191,11 +191,10 @@ namespace MediaBrowser.Model.IO
/// <summary>
/// Gets the files.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
/// <returns>IEnumerable&lt;FileInfo&gt;.</returns>
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
IEnumerable<FileSystemMetadata> GetFiles(string path, string [] extensions, bool enableCaseSensitiveExtensions, bool recursive);
/// <summary>
/// Gets the file system entries.
/// </summary>

View File

@ -199,7 +199,6 @@ namespace MediaBrowser.Providers.MediaInfo
{
return !video.SubtitleFiles
.SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, directoryService, _fileSystem, false)
.Select(i => i.FullName)
.OrderBy(i => i), StringComparer.OrdinalIgnoreCase);
}
}

View File

@ -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
// Once we reach a file that is at least the minimum, return all subsequent ones
var allVobs = _fileSystem.GetFiles(root, true)
.Where(file => string.Equals(file.Extension, ".vob", StringComparison.OrdinalIgnoreCase))
var allVobs = _fileSystem.GetFiles(root, new[] { ".vob" }, false, true)
.OrderBy(i => i.FullName)
.ToList();

View File

@ -6,8 +6,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Globalization;
@ -36,11 +34,9 @@ namespace MediaBrowser.Providers.MediaInfo
var videoFileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(video.Path);
videoFileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(videoFileNameWithoutExtension);
foreach (var file in files)
foreach (var fullName in files)
{
var fullName = file.FullName;
var fileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(file);
var fileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(fullName);
fileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(fileNameWithoutExtension);
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;
@ -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));
}
var files = directoryService.GetFiles(containingPath, clearCache);
var files = directoryService.GetFilePaths(containingPath, clearCache);
var videoFileNameWithoutExtension = fileSystem.GetFileNameWithoutExtension(video.Path);
return files.Where(i =>
{
if (!i.IsDirectory &&
SubtitleExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
var extension = Path.GetExtension(i);
if (SubtitleExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
var fileNameWithoutExtension = fileSystem.GetFileNameWithoutExtension(i);

View File

@ -436,7 +436,7 @@ namespace MediaBrowser.Providers.TV
{
try
{
var files = _fileSystem.GetFiles(seriesDataPath)
var files = _fileSystem.GetFiles(seriesDataPath, new[] { ".xml" }, true, false)
.ToList();
var seriesXmlFilename = preferredMetadataLanguage + ".xml";