|
@@ -4,6 +4,7 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
+using MediaBrowser.Common.IO;
|
|
|
|
|
|
namespace MediaBrowser.Controller.MediaEncoding
|
|
|
{
|
|
@@ -15,29 +16,30 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|
|
/// <summary>
|
|
|
/// Gets the input argument.
|
|
|
/// </summary>
|
|
|
+ /// <param name="fileSystem">The file system.</param>
|
|
|
/// <param name="videoPath">The video path.</param>
|
|
|
/// <param name="protocol">The protocol.</param>
|
|
|
/// <param name="isoMount">The iso mount.</param>
|
|
|
/// <param name="playableStreamFileNames">The playable stream file names.</param>
|
|
|
/// <returns>System.String[][].</returns>
|
|
|
- public static string[] GetInputArgument(string videoPath, MediaProtocol protocol, IIsoMount isoMount, List<string> playableStreamFileNames)
|
|
|
+ public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, List<string> playableStreamFileNames)
|
|
|
{
|
|
|
if (playableStreamFileNames.Count > 0)
|
|
|
{
|
|
|
if (isoMount == null)
|
|
|
{
|
|
|
- return GetPlayableStreamFiles(videoPath, playableStreamFileNames).ToArray();
|
|
|
+ return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames).ToArray();
|
|
|
}
|
|
|
- return GetPlayableStreamFiles(isoMount.MountedPath, playableStreamFileNames).ToArray();
|
|
|
+ return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames).ToArray();
|
|
|
}
|
|
|
|
|
|
return new[] {videoPath};
|
|
|
}
|
|
|
|
|
|
- public static List<string> GetPlayableStreamFiles(string rootPath, IEnumerable<string> filenames)
|
|
|
+ public static List<string> GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, IEnumerable<string> filenames)
|
|
|
{
|
|
|
- var allFiles = Directory
|
|
|
- .EnumerateFiles(rootPath, "*", SearchOption.AllDirectories)
|
|
|
+ var allFiles = fileSystem
|
|
|
+ .GetFilePaths(rootPath, true)
|
|
|
.ToList();
|
|
|
|
|
|
return filenames.Select(name => allFiles.FirstOrDefault(f => string.Equals(Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase)))
|