mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #7370 from crobibero/internal-metadata-path
Only add internal files if the internal metadata path exists
This commit is contained in:
commit
136eab9b1e
@ -704,6 +704,18 @@ namespace Emby.Server.Implementations.IO
|
|||||||
return Directory.EnumerateFileSystemEntries(path, "*", GetEnumerationOptions(recursive));
|
return Directory.EnumerateFileSystemEntries(path, "*", GetEnumerationOptions(recursive));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual bool DirectoryExists(string path)
|
||||||
|
{
|
||||||
|
return Directory.Exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual bool FileExists(string path)
|
||||||
|
{
|
||||||
|
return File.Exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
private EnumerationOptions GetEnumerationOptions(bool recursive)
|
private EnumerationOptions GetEnumerationOptions(bool recursive)
|
||||||
{
|
{
|
||||||
return new EnumerationOptions
|
return new EnumerationOptions
|
||||||
|
@ -887,7 +887,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetInternalMetadataPath()
|
public virtual string GetInternalMetadataPath()
|
||||||
{
|
{
|
||||||
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
|
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
|
||||||
|
|
||||||
|
@ -200,5 +200,19 @@ namespace MediaBrowser.Model.IO
|
|||||||
void SetAttributes(string path, bool isHidden, bool readOnly);
|
void SetAttributes(string path, bool isHidden, bool readOnly);
|
||||||
|
|
||||||
IEnumerable<FileSystemMetadata> GetDrives();
|
IEnumerable<FileSystemMetadata> GetDrives();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the directory exists.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
|
/// <returns>Whether the path exists.</returns>
|
||||||
|
bool DirectoryExists(string path);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the file exists.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
|
/// <returns>Whether the path exists.</returns>
|
||||||
|
bool FileExists(string path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.MediaInfo
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
@ -16,13 +17,20 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="localizationManager">The localization manager.</param>
|
/// <param name="localizationManager">The localization manager.</param>
|
||||||
/// <param name="mediaEncoder">The media encoder.</param>
|
/// <param name="mediaEncoder">The media encoder.</param>
|
||||||
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFlags, MediaForcedFlags and MediaFlagDelimiters.</param>
|
/// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFlags, MediaForcedFlags and MediaFlagDelimiters.</param>
|
||||||
public AudioResolver(
|
public AudioResolver(
|
||||||
ILocalizationManager localizationManager,
|
ILocalizationManager localizationManager,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
|
IFileSystem fileSystem,
|
||||||
NamingOptions namingOptions)
|
NamingOptions namingOptions)
|
||||||
: base(localizationManager, mediaEncoder, namingOptions, DlnaProfileType.Audio)
|
: base(
|
||||||
{
|
localizationManager,
|
||||||
|
mediaEncoder,
|
||||||
|
fileSystem,
|
||||||
|
namingOptions,
|
||||||
|
DlnaProfileType.Audio)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@ using MediaBrowser.Controller.MediaEncoding;
|
|||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Subtitles;
|
using MediaBrowser.Controller.Subtitles;
|
||||||
using MediaBrowser.Model.Dlna;
|
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@ -58,11 +58,12 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
ISubtitleManager subtitleManager,
|
ISubtitleManager subtitleManager,
|
||||||
IChapterManager chapterManager,
|
IChapterManager chapterManager,
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
|
IFileSystem fileSystem,
|
||||||
NamingOptions namingOptions)
|
NamingOptions namingOptions)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_audioResolver = new AudioResolver(localization, mediaEncoder, namingOptions);
|
_audioResolver = new AudioResolver(localization, mediaEncoder, fileSystem, namingOptions);
|
||||||
_subtitleResolver = new SubtitleResolver(localization, mediaEncoder, namingOptions);
|
_subtitleResolver = new SubtitleResolver(localization, mediaEncoder, fileSystem, namingOptions);
|
||||||
_videoProber = new FFProbeVideoInfo(
|
_videoProber = new FFProbeVideoInfo(
|
||||||
_logger,
|
_logger,
|
||||||
mediaSourceManager,
|
mediaSourceManager,
|
||||||
|
@ -14,6 +14,7 @@ using MediaBrowser.Model.Dlna;
|
|||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.MediaInfo
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
@ -43,6 +44,8 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IMediaEncoder _mediaEncoder;
|
private readonly IMediaEncoder _mediaEncoder;
|
||||||
|
|
||||||
|
private readonly IFileSystem _fileSystem;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="NamingOptions"/> instance.
|
/// The <see cref="NamingOptions"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -58,15 +61,18 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="localizationManager">The localization manager.</param>
|
/// <param name="localizationManager">The localization manager.</param>
|
||||||
/// <param name="mediaEncoder">The media encoder.</param>
|
/// <param name="mediaEncoder">The media encoder.</param>
|
||||||
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFlags, MediaForcedFlags and MediaFlagDelimiters.</param>
|
/// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFlags, MediaForcedFlags and MediaFlagDelimiters.</param>
|
||||||
/// <param name="type">The <see cref="DlnaProfileType"/> of the parsed file.</param>
|
/// <param name="type">The <see cref="DlnaProfileType"/> of the parsed file.</param>
|
||||||
protected MediaInfoResolver(
|
protected MediaInfoResolver(
|
||||||
ILocalizationManager localizationManager,
|
ILocalizationManager localizationManager,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
|
IFileSystem fileSystem,
|
||||||
NamingOptions namingOptions,
|
NamingOptions namingOptions,
|
||||||
DlnaProfileType type)
|
DlnaProfileType type)
|
||||||
{
|
{
|
||||||
_mediaEncoder = mediaEncoder;
|
_mediaEncoder = mediaEncoder;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
_namingOptions = namingOptions;
|
_namingOptions = namingOptions;
|
||||||
_type = type;
|
_type = type;
|
||||||
_externalPathParser = new ExternalPathParser(namingOptions, localizationManager, _type);
|
_externalPathParser = new ExternalPathParser(namingOptions, localizationManager, _type);
|
||||||
@ -148,7 +154,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
|
|
||||||
// Check if video folder exists
|
// Check if video folder exists
|
||||||
string folder = video.ContainingFolderPath;
|
string folder = video.ContainingFolderPath;
|
||||||
if (!Directory.Exists(folder))
|
if (!_fileSystem.DirectoryExists(folder))
|
||||||
{
|
{
|
||||||
return Array.Empty<ExternalPathParserResult>();
|
return Array.Empty<ExternalPathParserResult>();
|
||||||
}
|
}
|
||||||
@ -156,7 +162,11 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
var externalPathInfos = new List<ExternalPathParserResult>();
|
var externalPathInfos = new List<ExternalPathParserResult>();
|
||||||
|
|
||||||
var files = directoryService.GetFilePaths(folder, clearCache).ToList();
|
var files = directoryService.GetFilePaths(folder, clearCache).ToList();
|
||||||
files.AddRange(directoryService.GetFilePaths(video.GetInternalMetadataPath(), clearCache));
|
var internalMetadataPath = video.GetInternalMetadataPath();
|
||||||
|
if (_fileSystem.DirectoryExists(internalMetadataPath))
|
||||||
|
{
|
||||||
|
files.AddRange(directoryService.GetFilePaths(internalMetadataPath, clearCache));
|
||||||
|
}
|
||||||
|
|
||||||
if (!files.Any())
|
if (!files.Any())
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.MediaInfo
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
@ -16,13 +17,20 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="localizationManager">The localization manager.</param>
|
/// <param name="localizationManager">The localization manager.</param>
|
||||||
/// <param name="mediaEncoder">The media encoder.</param>
|
/// <param name="mediaEncoder">The media encoder.</param>
|
||||||
|
/// <param name="fileSystem">The file system.</param>
|
||||||
/// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFlags, MediaForcedFlags and MediaFlagDelimiters.</param>
|
/// <param name="namingOptions">The <see cref="NamingOptions"/> object containing FileExtensions, MediaDefaultFlags, MediaForcedFlags and MediaFlagDelimiters.</param>
|
||||||
public SubtitleResolver(
|
public SubtitleResolver(
|
||||||
ILocalizationManager localizationManager,
|
ILocalizationManager localizationManager,
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
|
IFileSystem fileSystem,
|
||||||
NamingOptions namingOptions)
|
NamingOptions namingOptions)
|
||||||
: base(localizationManager, mediaEncoder, namingOptions, DlnaProfileType.Subtitle)
|
: base(
|
||||||
{
|
localizationManager,
|
||||||
|
mediaEncoder,
|
||||||
|
fileSystem,
|
||||||
|
namingOptions,
|
||||||
|
DlnaProfileType.Subtitle)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using MediaBrowser.Controller.LiveTv;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Providers.MediaInfo;
|
using MediaBrowser.Providers.MediaInfo;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@ -45,7 +46,13 @@ public class AudioResolverTests
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
_audioResolver = new AudioResolver(localizationManager, mediaEncoder.Object, new NamingOptions());
|
var fileSystem = new Mock<IFileSystem>(MockBehavior.Strict);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.VideoDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.MetadataDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
_audioResolver = new AudioResolver(localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
@ -15,6 +15,7 @@ using MediaBrowser.Controller.MediaEncoding;
|
|||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Providers.MediaInfo;
|
using MediaBrowser.Providers.MediaInfo;
|
||||||
using Moq;
|
using Moq;
|
||||||
@ -25,9 +26,9 @@ namespace Jellyfin.Providers.Tests.MediaInfo;
|
|||||||
public class MediaInfoResolverTests
|
public class MediaInfoResolverTests
|
||||||
{
|
{
|
||||||
public const string VideoDirectoryPath = "Test Data/Video";
|
public const string VideoDirectoryPath = "Test Data/Video";
|
||||||
private const string VideoDirectoryRegex = @"Test Data[/\\]Video";
|
public const string VideoDirectoryRegex = @"Test Data[/\\]Video";
|
||||||
private const string MetadataDirectoryPath = "library/00/00000000000000000000000000000000";
|
public const string MetadataDirectoryPath = "library/00/00000000000000000000000000000000";
|
||||||
private const string MetadataDirectoryRegex = @"library.*";
|
public const string MetadataDirectoryRegex = @"library.*";
|
||||||
|
|
||||||
private readonly ILocalizationManager _localizationManager;
|
private readonly ILocalizationManager _localizationManager;
|
||||||
private readonly MediaInfoResolver _subtitleResolver;
|
private readonly MediaInfoResolver _subtitleResolver;
|
||||||
@ -61,13 +62,19 @@ public class MediaInfoResolverTests
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
_subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, new NamingOptions());
|
var fileSystem = new Mock<IFileSystem>(MockBehavior.Strict);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsAny<string>()))
|
||||||
|
.Returns(false);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(VideoDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MetadataDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
_subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Fact]
|
||||||
[InlineData("https://url.com/My.Video.mkv")]
|
public void GetExternalFiles_BadProtocol_ReturnsNoSubtitles()
|
||||||
[InlineData("non-existent/path")]
|
|
||||||
public void GetExternalFiles_BadPaths_ReturnsNoSubtitles(string path)
|
|
||||||
{
|
{
|
||||||
// need a media source manager capable of returning something other than file protocol
|
// need a media source manager capable of returning something other than file protocol
|
||||||
var mediaSourceManager = new Mock<IMediaSourceManager>();
|
var mediaSourceManager = new Mock<IMediaSourceManager>();
|
||||||
@ -77,12 +84,52 @@ public class MediaInfoResolverTests
|
|||||||
|
|
||||||
var video = new Movie
|
var video = new Movie
|
||||||
{
|
{
|
||||||
Path = path
|
Path = "https://url.com/My.Video.mkv"
|
||||||
};
|
};
|
||||||
|
|
||||||
var files = _subtitleResolver.GetExternalFiles(video, Mock.Of<IDirectoryService>(), false);
|
Assert.Empty(_subtitleResolver.GetExternalFiles(video, Mock.Of<IDirectoryService>(), false));
|
||||||
|
}
|
||||||
|
|
||||||
Assert.Empty(files);
|
[Theory]
|
||||||
|
[InlineData(false)]
|
||||||
|
[InlineData(true)]
|
||||||
|
public void GetExternalFiles_MissingDirectory_DirectoryNotQueried(bool metadataDirectory)
|
||||||
|
{
|
||||||
|
BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>();
|
||||||
|
|
||||||
|
string containingFolderPath, metadataPath;
|
||||||
|
|
||||||
|
if (metadataDirectory)
|
||||||
|
{
|
||||||
|
containingFolderPath = VideoDirectoryPath;
|
||||||
|
metadataPath = "invalid";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
containingFolderPath = "invalid";
|
||||||
|
metadataPath = MetadataDirectoryPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
var video = new Mock<Movie>();
|
||||||
|
video.Setup(m => m.Path)
|
||||||
|
.Returns(VideoDirectoryPath + "/My.Video.mkv");
|
||||||
|
video.Setup(m => m.ContainingFolderPath)
|
||||||
|
.Returns(containingFolderPath);
|
||||||
|
video.Setup(m => m.GetInternalMetadataPath())
|
||||||
|
.Returns(metadataPath);
|
||||||
|
|
||||||
|
string pathNotFoundRegex = metadataDirectory ? MetadataDirectoryRegex : VideoDirectoryRegex;
|
||||||
|
|
||||||
|
var directoryService = new Mock<IDirectoryService>(MockBehavior.Strict);
|
||||||
|
// any path other than test target exists and provides an empty listing
|
||||||
|
directoryService.Setup(ds => ds.GetFilePaths(It.IsAny<string>(), It.IsAny<bool>(), It.IsAny<bool>()))
|
||||||
|
.Returns(Array.Empty<string>());
|
||||||
|
|
||||||
|
_subtitleResolver.GetExternalFiles(video.Object, directoryService.Object, false);
|
||||||
|
|
||||||
|
directoryService.Verify(
|
||||||
|
ds => ds.GetFilePaths(It.IsRegex(pathNotFoundRegex), It.IsAny<bool>(), It.IsAny<bool>()),
|
||||||
|
Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
@ -132,7 +179,6 @@ public class MediaInfoResolverTests
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("https://url.com/My.Video.mkv")]
|
[InlineData("https://url.com/My.Video.mkv")]
|
||||||
[InlineData("non-existent/path")]
|
|
||||||
[InlineData(VideoDirectoryPath)] // valid but no files found for this test
|
[InlineData(VideoDirectoryPath)] // valid but no files found for this test
|
||||||
public async void GetExternalStreams_BadPaths_ReturnsNoSubtitles(string path)
|
public async void GetExternalStreams_BadPaths_ReturnsNoSubtitles(string path)
|
||||||
{
|
{
|
||||||
@ -152,8 +198,9 @@ public class MediaInfoResolverTests
|
|||||||
.Returns(Array.Empty<string>());
|
.Returns(Array.Empty<string>());
|
||||||
|
|
||||||
var mediaEncoder = Mock.Of<IMediaEncoder>(MockBehavior.Strict);
|
var mediaEncoder = Mock.Of<IMediaEncoder>(MockBehavior.Strict);
|
||||||
|
var fileSystem = Mock.Of<IFileSystem>();
|
||||||
|
|
||||||
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder, new NamingOptions());
|
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder, fileSystem, new NamingOptions());
|
||||||
|
|
||||||
var streams = await subtitleResolver.GetExternalStreamsAsync(video, 0, directoryService.Object, false, CancellationToken.None);
|
var streams = await subtitleResolver.GetExternalStreamsAsync(video, 0, directoryService.Object, false, CancellationToken.None);
|
||||||
|
|
||||||
@ -252,7 +299,13 @@ public class MediaInfoResolverTests
|
|||||||
MediaStreams = inputStreams.ToList()
|
MediaStreams = inputStreams.ToList()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, new NamingOptions());
|
var fileSystem = new Mock<IFileSystem>(MockBehavior.Strict);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(VideoDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MetadataDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
|
||||||
|
|
||||||
var directoryService = GetDirectoryServiceForExternalFile(file);
|
var directoryService = GetDirectoryServiceForExternalFile(file);
|
||||||
var streams = await subtitleResolver.GetExternalStreamsAsync(video, 0, directoryService, false, CancellationToken.None);
|
var streams = await subtitleResolver.GetExternalStreamsAsync(video, 0, directoryService, false, CancellationToken.None);
|
||||||
@ -318,7 +371,13 @@ public class MediaInfoResolverTests
|
|||||||
MediaStreams = GenerateMediaStreams()
|
MediaStreams = GenerateMediaStreams()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, new NamingOptions());
|
var fileSystem = new Mock<IFileSystem>(MockBehavior.Strict);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(VideoDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MetadataDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
var subtitleResolver = new SubtitleResolver(_localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
|
||||||
|
|
||||||
int startIndex = 1;
|
int startIndex = 1;
|
||||||
var streams = await subtitleResolver.GetExternalStreamsAsync(video, startIndex, directoryService.Object, false, CancellationToken.None);
|
var streams = await subtitleResolver.GetExternalStreamsAsync(video, startIndex, directoryService.Object, false, CancellationToken.None);
|
||||||
|
@ -11,6 +11,7 @@ using MediaBrowser.Controller.LiveTv;
|
|||||||
using MediaBrowser.Controller.MediaEncoding;
|
using MediaBrowser.Controller.MediaEncoding;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Globalization;
|
using MediaBrowser.Model.Globalization;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Providers.MediaInfo;
|
using MediaBrowser.Providers.MediaInfo;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@ -45,7 +46,13 @@ public class SubtitleResolverTests
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
_subtitleResolver = new SubtitleResolver(localizationManager, mediaEncoder.Object, new NamingOptions());
|
var fileSystem = new Mock<IFileSystem>(MockBehavior.Strict);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.VideoDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
fileSystem.Setup(fs => fs.DirectoryExists(It.IsRegex(MediaInfoResolverTests.MetadataDirectoryRegex)))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
_subtitleResolver = new SubtitleResolver(localizationManager, mediaEncoder.Object, fileSystem.Object, new NamingOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user