Remove ILibraryManager as a dependency in resolvers etc.
This commit is contained in:
parent
4cb649853d
commit
4f45c52674
|
@ -19,6 +19,7 @@ using Emby.Dlna;
|
||||||
using Emby.Dlna.Main;
|
using Emby.Dlna.Main;
|
||||||
using Emby.Dlna.Ssdp;
|
using Emby.Dlna.Ssdp;
|
||||||
using Emby.Drawing;
|
using Emby.Drawing;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using Emby.Notifications;
|
using Emby.Notifications;
|
||||||
using Emby.Photos;
|
using Emby.Photos;
|
||||||
using Emby.Server.Implementations.Archiving;
|
using Emby.Server.Implementations.Archiving;
|
||||||
|
@ -596,6 +597,7 @@ namespace Emby.Server.Implementations
|
||||||
serviceCollection.AddTransient(provider => new Lazy<IProviderManager>(provider.GetRequiredService<IProviderManager>));
|
serviceCollection.AddTransient(provider => new Lazy<IProviderManager>(provider.GetRequiredService<IProviderManager>));
|
||||||
serviceCollection.AddTransient(provider => new Lazy<IUserViewManager>(provider.GetRequiredService<IUserViewManager>));
|
serviceCollection.AddTransient(provider => new Lazy<IUserViewManager>(provider.GetRequiredService<IUserViewManager>));
|
||||||
serviceCollection.AddSingleton<ILibraryManager, LibraryManager>();
|
serviceCollection.AddSingleton<ILibraryManager, LibraryManager>();
|
||||||
|
serviceCollection.AddSingleton<NamingOptions>();
|
||||||
|
|
||||||
serviceCollection.AddSingleton<IMusicManager, MusicManager>();
|
serviceCollection.AddSingleton<IMusicManager, MusicManager>();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Emby.Naming.Audio;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
|
@ -13,17 +14,17 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CoreResolutionIgnoreRule : IResolverIgnoreRule
|
public class CoreResolutionIgnoreRule : IResolverIgnoreRule
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly NamingOptions _namingOptions;
|
||||||
private readonly IServerApplicationPaths _serverApplicationPaths;
|
private readonly IServerApplicationPaths _serverApplicationPaths;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="CoreResolutionIgnoreRule"/> class.
|
/// Initializes a new instance of the <see cref="CoreResolutionIgnoreRule"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
/// <param name="serverApplicationPaths">The server application paths.</param>
|
/// <param name="serverApplicationPaths">The server application paths.</param>
|
||||||
public CoreResolutionIgnoreRule(ILibraryManager libraryManager, IServerApplicationPaths serverApplicationPaths)
|
public CoreResolutionIgnoreRule(NamingOptions namingOptions, IServerApplicationPaths serverApplicationPaths)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_namingOptions = namingOptions;
|
||||||
_serverApplicationPaths = serverApplicationPaths;
|
_serverApplicationPaths = serverApplicationPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
// Don't resolve these into audio files
|
// Don't resolve these into audio files
|
||||||
if (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal)
|
if (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal)
|
||||||
&& _libraryManager.IsAudioFile(filename))
|
&& AudioFileParser.IsAudioFile(filename, _namingOptions))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly IFileSystem _fileSystem;
|
||||||
private readonly IItemRepository _itemRepository;
|
private readonly IItemRepository _itemRepository;
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
|
private readonly NamingOptions _namingOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _root folder sync lock.
|
/// The _root folder sync lock.
|
||||||
|
@ -88,9 +89,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24);
|
private readonly TimeSpan _viewRefreshInterval = TimeSpan.FromHours(24);
|
||||||
|
|
||||||
private NamingOptions _namingOptions;
|
|
||||||
private string[] _videoFileExtensions;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _root folder.
|
/// The _root folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -116,6 +114,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
/// <param name="itemRepository">The item repository.</param>
|
/// <param name="itemRepository">The item repository.</param>
|
||||||
/// <param name="imageProcessor">The image processor.</param>
|
/// <param name="imageProcessor">The image processor.</param>
|
||||||
/// <param name="memoryCache">The memory cache.</param>
|
/// <param name="memoryCache">The memory cache.</param>
|
||||||
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
public LibraryManager(
|
public LibraryManager(
|
||||||
IServerApplicationHost appHost,
|
IServerApplicationHost appHost,
|
||||||
ILogger<LibraryManager> logger,
|
ILogger<LibraryManager> logger,
|
||||||
|
@ -130,7 +129,8 @@ namespace Emby.Server.Implementations.Library
|
||||||
IMediaEncoder mediaEncoder,
|
IMediaEncoder mediaEncoder,
|
||||||
IItemRepository itemRepository,
|
IItemRepository itemRepository,
|
||||||
IImageProcessor imageProcessor,
|
IImageProcessor imageProcessor,
|
||||||
IMemoryCache memoryCache)
|
IMemoryCache memoryCache,
|
||||||
|
NamingOptions namingOptions)
|
||||||
{
|
{
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
@ -146,6 +146,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
_itemRepository = itemRepository;
|
_itemRepository = itemRepository;
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
_memoryCache = memoryCache;
|
_memoryCache = memoryCache;
|
||||||
|
_namingOptions = namingOptions;
|
||||||
|
|
||||||
_configurationManager.ConfigurationUpdated += ConfigurationUpdated;
|
_configurationManager.ConfigurationUpdated += ConfigurationUpdated;
|
||||||
|
|
||||||
|
@ -2500,16 +2501,6 @@ namespace Emby.Server.Implementations.Library
|
||||||
return RootFolder;
|
return RootFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public bool IsVideoFile(string path)
|
|
||||||
{
|
|
||||||
return VideoResolver.IsVideoFile(path, GetNamingOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public bool IsAudioFile(string path)
|
|
||||||
=> AudioFileParser.IsAudioFile(path, GetNamingOptions());
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int? GetSeasonNumberFromPath(string path)
|
public int? GetSeasonNumberFromPath(string path)
|
||||||
=> SeasonPathParser.Parse(path, true, true).SeasonNumber;
|
=> SeasonPathParser.Parse(path, true, true).SeasonNumber;
|
||||||
|
@ -2525,7 +2516,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
isAbsoluteNaming = null;
|
isAbsoluteNaming = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var resolver = new EpisodeResolver(GetNamingOptions());
|
var resolver = new EpisodeResolver(_namingOptions);
|
||||||
|
|
||||||
var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd;
|
var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd;
|
||||||
|
|
||||||
|
@ -2682,21 +2673,9 @@ namespace Emby.Server.Implementations.Library
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public NamingOptions GetNamingOptions()
|
|
||||||
{
|
|
||||||
if (_namingOptions == null)
|
|
||||||
{
|
|
||||||
_namingOptions = new NamingOptions();
|
|
||||||
_videoFileExtensions = _namingOptions.VideoFileExtensions;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _namingOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemLookupInfo ParseName(string name)
|
public ItemLookupInfo ParseName(string name)
|
||||||
{
|
{
|
||||||
var namingOptions = GetNamingOptions();
|
var namingOptions = _namingOptions;
|
||||||
var result = VideoResolver.CleanDateTime(name, namingOptions);
|
var result = VideoResolver.CleanDateTime(name, namingOptions);
|
||||||
|
|
||||||
return new ItemLookupInfo
|
return new ItemLookupInfo
|
||||||
|
@ -2708,11 +2687,11 @@ 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 namingOptions = _namingOptions;
|
||||||
|
|
||||||
var files = owner.IsInMixedFolder ? new List<FileSystemMetadata>() : fileSystemChildren.Where(i => i.IsDirectory)
|
var files = owner.IsInMixedFolder ? new List<FileSystemMetadata>() : fileSystemChildren.Where(i => i.IsDirectory)
|
||||||
.Where(i => string.Equals(i.Name, BaseItem.TrailersFolderName, StringComparison.OrdinalIgnoreCase))
|
.Where(i => string.Equals(i.Name, BaseItem.TrailersFolderName, StringComparison.OrdinalIgnoreCase))
|
||||||
.SelectMany(i => _fileSystem.GetFiles(i.FullName, _videoFileExtensions, false, false))
|
.SelectMany(i => _fileSystem.GetFiles(i.FullName, namingOptions.VideoFileExtensions, false, false))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var videos = VideoListResolver.Resolve(fileSystemChildren, namingOptions);
|
var videos = VideoListResolver.Resolve(fileSystemChildren, namingOptions);
|
||||||
|
@ -2726,7 +2705,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var resolvers = new IItemResolver[]
|
var resolvers = new IItemResolver[]
|
||||||
{
|
{
|
||||||
new GenericVideoResolver<Trailer>(this)
|
new GenericVideoResolver<Trailer>(_namingOptions)
|
||||||
};
|
};
|
||||||
|
|
||||||
return ResolvePaths(files, directoryService, null, new LibraryOptions(), null, resolvers)
|
return ResolvePaths(files, directoryService, null, new LibraryOptions(), null, resolvers)
|
||||||
|
@ -2752,11 +2731,11 @@ 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 namingOptions = _namingOptions;
|
||||||
|
|
||||||
var files = owner.IsInMixedFolder ? new List<FileSystemMetadata>() : fileSystemChildren.Where(i => i.IsDirectory)
|
var files = owner.IsInMixedFolder ? new List<FileSystemMetadata>() : fileSystemChildren.Where(i => i.IsDirectory)
|
||||||
.Where(i => BaseItem.AllExtrasTypesFolderNames.ContainsKey(i.Name ?? string.Empty))
|
.Where(i => BaseItem.AllExtrasTypesFolderNames.ContainsKey(i.Name ?? string.Empty))
|
||||||
.SelectMany(i => _fileSystem.GetFiles(i.FullName, _videoFileExtensions, false, false))
|
.SelectMany(i => _fileSystem.GetFiles(i.FullName, namingOptions.VideoFileExtensions, false, false))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var videos = VideoListResolver.Resolve(fileSystemChildren, namingOptions);
|
var videos = VideoListResolver.Resolve(fileSystemChildren, namingOptions);
|
||||||
|
@ -2840,7 +2819,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private void SetExtraTypeFromFilename(Video item)
|
private void SetExtraTypeFromFilename(Video item)
|
||||||
{
|
{
|
||||||
var resolver = new ExtraResolver(GetNamingOptions());
|
var resolver = new ExtraResolver(_namingOptions);
|
||||||
|
|
||||||
var result = resolver.GetExtraInfo(item.Path);
|
var result = resolver.GetExtraInfo(item.Path);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,10 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Emby.Naming.Audio;
|
||||||
using Emby.Naming.AudioBook;
|
using Emby.Naming.AudioBook;
|
||||||
|
using Emby.Naming.Common;
|
||||||
|
using Emby.Naming.Video;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
@ -21,11 +24,11 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AudioResolver : ItemResolver<MediaBrowser.Controller.Entities.Audio.Audio>, IMultiItemResolver
|
public class AudioResolver : ItemResolver<MediaBrowser.Controller.Entities.Audio.Audio>, IMultiItemResolver
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly NamingOptions _namingOptions;
|
||||||
|
|
||||||
public AudioResolver(ILibraryManager libraryManager)
|
public AudioResolver(NamingOptions namingOptions)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_namingOptions = namingOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -40,7 +43,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
string collectionType,
|
string collectionType,
|
||||||
IDirectoryService directoryService)
|
IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var result = ResolveMultipleInternal(parent, files, collectionType, directoryService);
|
var result = ResolveMultipleInternal(parent, files, collectionType);
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
@ -56,12 +59,11 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
private MultiItemResolverResult ResolveMultipleInternal(
|
private MultiItemResolverResult ResolveMultipleInternal(
|
||||||
Folder parent,
|
Folder parent,
|
||||||
List<FileSystemMetadata> files,
|
List<FileSystemMetadata> files,
|
||||||
string collectionType,
|
string collectionType)
|
||||||
IDirectoryService directoryService)
|
|
||||||
{
|
{
|
||||||
if (string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return ResolveMultipleAudio<AudioBook>(parent, files, directoryService, false, collectionType, true);
|
return ResolveMultipleAudio(parent, files, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -87,14 +89,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var files = args.FileSystemChildren
|
return FindAudioBook(args, false);
|
||||||
.Where(i => !_libraryManager.IgnoreFile(i, args.Parent))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return FindAudio<AudioBook>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_libraryManager.IsAudioFile(args.Path))
|
if (AudioFileParser.IsAudioFile(args.Path, _namingOptions))
|
||||||
{
|
{
|
||||||
var extension = Path.GetExtension(args.Path);
|
var extension = Path.GetExtension(args.Path);
|
||||||
|
|
||||||
|
@ -107,7 +105,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
var isMixedCollectionType = string.IsNullOrEmpty(collectionType);
|
var isMixedCollectionType = string.IsNullOrEmpty(collectionType);
|
||||||
|
|
||||||
// For conflicting extensions, give priority to videos
|
// For conflicting extensions, give priority to videos
|
||||||
if (isMixedCollectionType && _libraryManager.IsVideoFile(args.Path))
|
if (isMixedCollectionType && VideoResolver.IsVideoFile(args.Path, _namingOptions))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -141,29 +139,23 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private T FindAudio<T>(ItemResolveArgs args, string path, Folder parent, List<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, string collectionType, bool parseName)
|
private AudioBook FindAudioBook(ItemResolveArgs args, bool parseName)
|
||||||
where T : MediaBrowser.Controller.Entities.Audio.Audio, new()
|
|
||||||
{
|
{
|
||||||
// TODO: Allow GetMultiDiscMovie in here
|
// TODO: Allow GetMultiDiscMovie in here
|
||||||
const bool supportsMultiVersion = false;
|
var result = ResolveMultipleAudio(args.Parent, args.GetActualFileSystemChildren(), parseName);
|
||||||
|
|
||||||
var result = ResolveMultipleAudio<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType, parseName) ??
|
if (result == null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
||||||
new MultiItemResolverResult();
|
|
||||||
|
|
||||||
if (result.Items.Count == 1)
|
|
||||||
{
|
{
|
||||||
// If we were supporting this we'd be checking filesFromOtherItems
|
return null;
|
||||||
var item = (T)result.Items[0];
|
|
||||||
item.IsInMixedFolder = false;
|
|
||||||
item.Name = Path.GetFileName(item.ContainingFolderPath);
|
|
||||||
return item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
// If we were supporting this we'd be checking filesFromOtherItems
|
||||||
|
item.IsInMixedFolder = false;
|
||||||
|
item.Name = Path.GetFileName(item.ContainingFolderPath);
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MultiItemResolverResult ResolveMultipleAudio<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions, string collectionType, bool parseName)
|
private MultiItemResolverResult ResolveMultipleAudio(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, bool parseName)
|
||||||
where T : MediaBrowser.Controller.Entities.Audio.Audio, new()
|
|
||||||
{
|
{
|
||||||
var files = new List<FileSystemMetadata>();
|
var files = new List<FileSystemMetadata>();
|
||||||
var items = new List<BaseItem>();
|
var items = new List<BaseItem>();
|
||||||
|
@ -176,15 +168,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
{
|
{
|
||||||
leftOver.Add(child);
|
leftOver.Add(child);
|
||||||
}
|
}
|
||||||
else if (!IsIgnored(child.Name))
|
else
|
||||||
{
|
{
|
||||||
files.Add(child);
|
files.Add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
|
var resolver = new AudioBookListResolver(_namingOptions);
|
||||||
|
|
||||||
var resolver = new AudioBookListResolver(namingOptions);
|
|
||||||
var resolverResult = resolver.Resolve(files).ToList();
|
var resolverResult = resolver.Resolve(files).ToList();
|
||||||
|
|
||||||
var result = new MultiItemResolverResult
|
var result = new MultiItemResolverResult
|
||||||
|
@ -210,7 +200,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
|
|
||||||
var firstMedia = resolvedItem.Files[0];
|
var firstMedia = resolvedItem.Files[0];
|
||||||
|
|
||||||
var libraryItem = new T
|
var libraryItem = new AudioBook
|
||||||
{
|
{
|
||||||
Path = firstMedia.Path,
|
Path = firstMedia.Path,
|
||||||
IsInMixedFolder = isInMixedFolder,
|
IsInMixedFolder = isInMixedFolder,
|
||||||
|
@ -230,12 +220,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ContainsFile(List<AudioBookInfo> result, FileSystemMetadata file)
|
private static bool ContainsFile(IEnumerable<AudioBookInfo> result, FileSystemMetadata file)
|
||||||
{
|
{
|
||||||
return result.Any(i => ContainsFile(i, file));
|
return result.Any(i => ContainsFile(i, file));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ContainsFile(AudioBookInfo result, FileSystemMetadata file)
|
private static bool ContainsFile(AudioBookInfo result, FileSystemMetadata file)
|
||||||
{
|
{
|
||||||
return result.Files.Any(i => ContainsFile(i, file)) ||
|
return result.Files.Any(i => ContainsFile(i, file)) ||
|
||||||
result.AlternateVersions.Any(i => ContainsFile(i, file)) ||
|
result.AlternateVersions.Any(i => ContainsFile(i, file)) ||
|
||||||
|
@ -246,10 +236,5 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
{
|
{
|
||||||
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
|
return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsIgnored(string filename)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Emby.Naming.Audio;
|
using Emby.Naming.Audio;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
@ -22,20 +23,17 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
public class MusicAlbumResolver : ItemResolver<MusicAlbum>
|
public class MusicAlbumResolver : ItemResolver<MusicAlbum>
|
||||||
{
|
{
|
||||||
private readonly ILogger<MusicAlbumResolver> _logger;
|
private readonly ILogger<MusicAlbumResolver> _logger;
|
||||||
private readonly IFileSystem _fileSystem;
|
private readonly NamingOptions _namingOptions;
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MusicAlbumResolver"/> class.
|
/// Initializes a new instance of the <see cref="MusicAlbumResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
public MusicAlbumResolver(ILogger<MusicAlbumResolver> logger, NamingOptions namingOptions)
|
||||||
public MusicAlbumResolver(ILogger<MusicAlbumResolver> logger, IFileSystem fileSystem, ILibraryManager libraryManager)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_fileSystem = fileSystem;
|
_namingOptions = namingOptions;
|
||||||
_libraryManager = libraryManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -87,7 +85,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// <returns><c>true</c> if the provided path points to a music album, <c>false</c> otherwise.</returns>
|
/// <returns><c>true</c> if the provided path points to a music album, <c>false</c> otherwise.</returns>
|
||||||
public bool IsMusicAlbum(string path, IDirectoryService directoryService)
|
public bool IsMusicAlbum(string path, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
return ContainsMusic(directoryService.GetFileSystemEntries(path), true, directoryService, _logger, _fileSystem, _libraryManager);
|
return ContainsMusic(directoryService.GetFileSystemEntries(path), true, directoryService);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -101,7 +99,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
if (args.IsDirectory)
|
if (args.IsDirectory)
|
||||||
{
|
{
|
||||||
// if (args.Parent is MusicArtist) return true; // saves us from testing children twice
|
// if (args.Parent is MusicArtist) return true; // saves us from testing children twice
|
||||||
if (ContainsMusic(args.FileSystemChildren, true, args.DirectoryService, _logger, _fileSystem, _libraryManager))
|
if (ContainsMusic(args.FileSystemChildren, true, args.DirectoryService))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -116,13 +114,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
private bool ContainsMusic(
|
private bool ContainsMusic(
|
||||||
IEnumerable<FileSystemMetadata> list,
|
IEnumerable<FileSystemMetadata> list,
|
||||||
bool allowSubfolders,
|
bool allowSubfolders,
|
||||||
IDirectoryService directoryService,
|
IDirectoryService directoryService)
|
||||||
ILogger<MusicAlbumResolver> logger,
|
|
||||||
IFileSystem fileSystem,
|
|
||||||
ILibraryManager libraryManager)
|
|
||||||
{
|
{
|
||||||
// check for audio files before digging down into directories
|
// check for audio files before digging down into directories
|
||||||
var foundAudioFile = list.Any(fileSystemInfo => !fileSystemInfo.IsDirectory && libraryManager.IsAudioFile(fileSystemInfo.FullName));
|
var foundAudioFile = list.Any(fileSystemInfo => !fileSystemInfo.IsDirectory && AudioFileParser.IsAudioFile(fileSystemInfo.FullName, _namingOptions));
|
||||||
if (foundAudioFile)
|
if (foundAudioFile)
|
||||||
{
|
{
|
||||||
// at least one audio file exists
|
// at least one audio file exists
|
||||||
|
@ -137,21 +132,20 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
|
|
||||||
var discSubfolderCount = 0;
|
var discSubfolderCount = 0;
|
||||||
|
|
||||||
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
|
var parser = new AlbumParser(_namingOptions);
|
||||||
var parser = new AlbumParser(namingOptions);
|
|
||||||
|
|
||||||
var directories = list.Where(fileSystemInfo => fileSystemInfo.IsDirectory);
|
var directories = list.Where(fileSystemInfo => fileSystemInfo.IsDirectory);
|
||||||
|
|
||||||
var result = Parallel.ForEach(directories, (fileSystemInfo, state) =>
|
var result = Parallel.ForEach(directories, (fileSystemInfo, state) =>
|
||||||
{
|
{
|
||||||
var path = fileSystemInfo.FullName;
|
var path = fileSystemInfo.FullName;
|
||||||
var hasMusic = ContainsMusic(directoryService.GetFileSystemEntries(path), false, directoryService, logger, fileSystem, libraryManager);
|
var hasMusic = ContainsMusic(directoryService.GetFileSystemEntries(path), false, directoryService);
|
||||||
|
|
||||||
if (hasMusic)
|
if (hasMusic)
|
||||||
{
|
{
|
||||||
if (parser.IsMultiPart(path))
|
if (parser.IsMultiPart(path))
|
||||||
{
|
{
|
||||||
logger.LogDebug("Found multi-disc folder: {Path}", path);
|
_logger.LogDebug("Found multi-disc folder: {Path}", path);
|
||||||
Interlocked.Increment(ref discSubfolderCount);
|
Interlocked.Increment(ref discSubfolderCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -19,27 +20,19 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
public class MusicArtistResolver : ItemResolver<MusicArtist>
|
public class MusicArtistResolver : ItemResolver<MusicArtist>
|
||||||
{
|
{
|
||||||
private readonly ILogger<MusicAlbumResolver> _logger;
|
private readonly ILogger<MusicAlbumResolver> _logger;
|
||||||
private readonly IFileSystem _fileSystem;
|
private NamingOptions _namingOptions;
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
private readonly IServerConfigurationManager _config;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MusicArtistResolver"/> class.
|
/// Initializes a new instance of the <see cref="MusicArtistResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger for the created <see cref="MusicAlbumResolver"/> instances.</param>
|
/// <param name="logger">The logger for the created <see cref="MusicAlbumResolver"/> instances.</param>
|
||||||
/// <param name="fileSystem">The file system.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
|
||||||
/// <param name="config">The configuration manager.</param>
|
|
||||||
public MusicArtistResolver(
|
public MusicArtistResolver(
|
||||||
ILogger<MusicAlbumResolver> logger,
|
ILogger<MusicAlbumResolver> logger,
|
||||||
IFileSystem fileSystem,
|
NamingOptions namingOptions)
|
||||||
ILibraryManager libraryManager,
|
|
||||||
IServerConfigurationManager config)
|
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_fileSystem = fileSystem;
|
_namingOptions = namingOptions;
|
||||||
_libraryManager = libraryManager;
|
|
||||||
_config = config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -89,7 +82,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
|
|
||||||
var directoryService = args.DirectoryService;
|
var directoryService = args.DirectoryService;
|
||||||
|
|
||||||
var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager);
|
var albumResolver = new MusicAlbumResolver(_logger, _namingOptions);
|
||||||
|
|
||||||
// If we contain an album assume we are an artist folder
|
// If we contain an album assume we are an artist folder
|
||||||
var directories = args.FileSystemChildren.Where(i => i.IsDirectory);
|
var directories = args.FileSystemChildren.Where(i => i.IsDirectory);
|
||||||
|
|
|
@ -6,6 +6,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using DiscUtils.Udf;
|
using DiscUtils.Udf;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using Emby.Naming.Video;
|
using Emby.Naming.Video;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -21,12 +22,12 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
public abstract class BaseVideoResolver<T> : MediaBrowser.Controller.Resolvers.ItemResolver<T>
|
public abstract class BaseVideoResolver<T> : MediaBrowser.Controller.Resolvers.ItemResolver<T>
|
||||||
where T : Video, new()
|
where T : Video, new()
|
||||||
{
|
{
|
||||||
protected BaseVideoResolver(ILibraryManager libraryManager)
|
protected BaseVideoResolver(NamingOptions namingOptions)
|
||||||
{
|
{
|
||||||
LibraryManager = libraryManager;
|
NamingOptions = namingOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ILibraryManager LibraryManager { get; }
|
protected NamingOptions NamingOptions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the specified args.
|
/// Resolves the specified args.
|
||||||
|
@ -48,7 +49,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
protected virtual TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName)
|
protected virtual TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName)
|
||||||
where TVideoType : Video, new()
|
where TVideoType : Video, new()
|
||||||
{
|
{
|
||||||
var namingOptions = LibraryManager.GetNamingOptions();
|
var namingOptions = NamingOptions;
|
||||||
|
|
||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
if (args.IsDirectory)
|
if (args.IsDirectory)
|
||||||
|
@ -138,7 +139,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LibraryManager.IsVideoFile(args.Path) || videoInfo.IsStub)
|
if (VideoResolver.IsVideoFile(args.Path, NamingOptions) || videoInfo.IsStub)
|
||||||
{
|
{
|
||||||
var path = args.Path;
|
var path = args.Path;
|
||||||
|
|
||||||
|
@ -267,7 +268,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
|
|
||||||
protected void Set3DFormat(Video video)
|
protected void Set3DFormat(Video video)
|
||||||
{
|
{
|
||||||
var result = Format3DParser.Parse(video.Path, LibraryManager.GetNamingOptions());
|
var result = Format3DParser.Parse(video.Path, NamingOptions);
|
||||||
|
|
||||||
Set3DFormat(video, result.Is3D, result.Format3D);
|
Set3DFormat(video, result.Is3D, result.Format3D);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
|
using Emby.Naming.Common;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Resolvers
|
namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
{
|
{
|
||||||
public class GenericVideoResolver<T> : BaseVideoResolver<T>
|
public class GenericVideoResolver<T> : BaseVideoResolver<T>
|
||||||
where T : Video, new()
|
where T : Video, new()
|
||||||
{
|
{
|
||||||
public GenericVideoResolver(ILibraryManager libraryManager)
|
public GenericVideoResolver(NamingOptions namingOptions)
|
||||||
: base(libraryManager)
|
: base(namingOptions)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using Emby.Naming.Video;
|
using Emby.Naming.Video;
|
||||||
using Jellyfin.Extensions;
|
using Jellyfin.Extensions;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
|
@ -25,6 +26,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver
|
public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver
|
||||||
{
|
{
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
|
private readonly StackResolver _stackResolver;
|
||||||
|
|
||||||
private string[] _validCollectionTypes = new[]
|
private string[] _validCollectionTypes = new[]
|
||||||
{
|
{
|
||||||
|
@ -38,12 +40,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="MovieResolver"/> class.
|
/// Initializes a new instance of the <see cref="MovieResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
|
||||||
/// <param name="imageProcessor">The image processor.</param>
|
/// <param name="imageProcessor">The image processor.</param>
|
||||||
public MovieResolver(ILibraryManager libraryManager, IImageProcessor imageProcessor)
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
: base(libraryManager)
|
public MovieResolver(IImageProcessor imageProcessor, NamingOptions namingOptions)
|
||||||
|
: base(namingOptions)
|
||||||
{
|
{
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
|
_stackResolver = new StackResolver(NamingOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -89,9 +92,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var files = args.FileSystemChildren
|
var files = args.GetActualFileSystemChildren().ToList();
|
||||||
.Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -258,9 +259,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var namingOptions = LibraryManager.GetNamingOptions();
|
var resolverResult = VideoListResolver.Resolve(files, NamingOptions, suppportMultiEditions).ToList();
|
||||||
|
|
||||||
var resolverResult = VideoListResolver.Resolve(files, namingOptions, suppportMultiEditions).ToList();
|
|
||||||
|
|
||||||
var result = new MultiItemResolverResult
|
var result = new MultiItemResolverResult
|
||||||
{
|
{
|
||||||
|
@ -438,7 +437,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
if (result.Items.Count == 1)
|
if (result.Items.Count == 1)
|
||||||
{
|
{
|
||||||
var videoPath = result.Items[0].Path;
|
var videoPath = result.Items[0].Path;
|
||||||
var hasPhotos = photos.Any(i => !PhotoResolver.IsOwnedByResolvedMedia(LibraryManager, videoPath, i.Name));
|
var hasPhotos = photos.Any(i => !PhotoResolver.IsOwnedByResolvedMedia(videoPath, i.Name));
|
||||||
|
|
||||||
if (!hasPhotos)
|
if (!hasPhotos)
|
||||||
{
|
{
|
||||||
|
@ -511,9 +510,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
var result = _stackResolver.ResolveDirectories(folderPaths).ToList();
|
||||||
|
|
||||||
var result = new StackResolver(namingOptions).ResolveDirectories(folderPaths).ToList();
|
|
||||||
|
|
||||||
if (result.Count != 1)
|
if (result.Count != 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -15,17 +16,17 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
public class PhotoAlbumResolver : GenericFolderResolver<PhotoAlbum>
|
public class PhotoAlbumResolver : GenericFolderResolver<PhotoAlbum>
|
||||||
{
|
{
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly NamingOptions _namingOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PhotoAlbumResolver"/> class.
|
/// Initializes a new instance of the <see cref="PhotoAlbumResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="imageProcessor">The image processor.</param>
|
/// <param name="imageProcessor">The image processor.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
public PhotoAlbumResolver(IImageProcessor imageProcessor, ILibraryManager libraryManager)
|
public PhotoAlbumResolver(IImageProcessor imageProcessor, NamingOptions namingOptions)
|
||||||
{
|
{
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
_libraryManager = libraryManager;
|
_namingOptions = namingOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
@ -73,7 +74,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
|
|
||||||
foreach (var siblingFile in files)
|
foreach (var siblingFile in files)
|
||||||
{
|
{
|
||||||
if (PhotoResolver.IsOwnedByMedia(_libraryManager, siblingFile.FullName, filename))
|
if (PhotoResolver.IsOwnedByMedia(_namingOptions, siblingFile.FullName, filename))
|
||||||
{
|
{
|
||||||
ownedByMedia = true;
|
ownedByMedia = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,6 +6,8 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Emby.Naming.Common;
|
||||||
|
using Emby.Naming.Video;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -16,7 +18,8 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
public class PhotoResolver : ItemResolver<Photo>
|
public class PhotoResolver : ItemResolver<Photo>
|
||||||
{
|
{
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly NamingOptions _namingOptions;
|
||||||
|
|
||||||
private static readonly HashSet<string> _ignoreFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
private static readonly HashSet<string> _ignoreFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
||||||
{
|
{
|
||||||
"folder",
|
"folder",
|
||||||
|
@ -30,10 +33,11 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
"default"
|
"default"
|
||||||
};
|
};
|
||||||
|
|
||||||
public PhotoResolver(IImageProcessor imageProcessor, ILibraryManager libraryManager)
|
|
||||||
|
public PhotoResolver(IImageProcessor imageProcessor, NamingOptions namingOptions)
|
||||||
{
|
{
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
_libraryManager = libraryManager;
|
_namingOptions = namingOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -60,7 +64,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
|
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
if (IsOwnedByMedia(_libraryManager, file.FullName, filename))
|
if (IsOwnedByMedia(_namingOptions, file.FullName, filename))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -77,17 +81,12 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsOwnedByMedia(ILibraryManager libraryManager, string file, string imageFilename)
|
internal static bool IsOwnedByMedia(NamingOptions namingOptions, string file, string imageFilename)
|
||||||
{
|
{
|
||||||
if (libraryManager.IsVideoFile(file))
|
return VideoResolver.IsVideoFile(file, namingOptions) && IsOwnedByResolvedMedia(file, imageFilename);
|
||||||
{
|
|
||||||
return IsOwnedByResolvedMedia(libraryManager, file, imageFilename);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsOwnedByResolvedMedia(ILibraryManager libraryManager, string file, string imageFilename)
|
internal static bool IsOwnedByResolvedMedia(string file, string imageFilename)
|
||||||
=> imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase);
|
=> imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
internal static bool IsImageFile(string path, IImageProcessor imageProcessor)
|
internal static bool IsImageFile(string path, IImageProcessor imageProcessor)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -17,9 +18,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="EpisodeResolver"/> class.
|
/// Initializes a new instance of the <see cref="EpisodeResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
public EpisodeResolver(ILibraryManager libraryManager)
|
public EpisodeResolver(NamingOptions namingOptions)
|
||||||
: base(libraryManager)
|
: base(namingOptions)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using Emby.Naming.TV;
|
using Emby.Naming.TV;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -14,22 +15,22 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SeasonResolver : GenericFolderResolver<Season>
|
public class SeasonResolver : GenericFolderResolver<Season>
|
||||||
{
|
{
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly ILogger<SeasonResolver> _logger;
|
private readonly ILogger<SeasonResolver> _logger;
|
||||||
|
private readonly NamingOptions _namingOptions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
|
/// Initializes a new instance of the <see cref="SeasonResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
/// <param name="localization">The localization.</param>
|
/// <param name="localization">The localization.</param>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
public SeasonResolver(
|
public SeasonResolver(
|
||||||
ILibraryManager libraryManager,
|
NamingOptions namingOptions,
|
||||||
ILocalizationManager localization,
|
ILocalizationManager localization,
|
||||||
ILogger<SeasonResolver> logger)
|
ILogger<SeasonResolver> logger)
|
||||||
{
|
{
|
||||||
_libraryManager = libraryManager;
|
_namingOptions = namingOptions;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
{
|
{
|
||||||
if (args.Parent is Series series && args.IsDirectory)
|
if (args.Parent is Series series && args.IsDirectory)
|
||||||
{
|
{
|
||||||
var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
|
var namingOptions = _namingOptions;
|
||||||
|
|
||||||
var path = args.Path;
|
var path = args.Path;
|
||||||
|
|
||||||
|
@ -65,18 +66,15 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
|
|
||||||
var episodeInfo = resolver.Resolve(testPath, true);
|
var episodeInfo = resolver.Resolve(testPath, true);
|
||||||
|
|
||||||
if (episodeInfo != null)
|
if (episodeInfo?.EpisodeNumber != null && episodeInfo.SeasonNumber.HasValue)
|
||||||
{
|
{
|
||||||
if (episodeInfo.EpisodeNumber.HasValue && episodeInfo.SeasonNumber.HasValue)
|
_logger.LogDebug(
|
||||||
{
|
"Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",
|
||||||
_logger.LogDebug(
|
path,
|
||||||
"Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",
|
episodeInfo.SeasonNumber.Value,
|
||||||
path,
|
episodeInfo.EpisodeNumber.Value);
|
||||||
episodeInfo.SeasonNumber.Value,
|
|
||||||
episodeInfo.EpisodeNumber.Value);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using Emby.Naming.Common;
|
||||||
using Emby.Naming.TV;
|
using Emby.Naming.TV;
|
||||||
|
using Emby.Naming.Video;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
|
@ -21,17 +26,23 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
public class SeriesResolver : GenericFolderResolver<Series>
|
public class SeriesResolver : GenericFolderResolver<Series>
|
||||||
{
|
{
|
||||||
private readonly ILogger<SeriesResolver> _logger;
|
private readonly ILogger<SeriesResolver> _logger;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly NamingOptions _namingOptions;
|
||||||
|
private readonly IFileSystem _fileSystem;
|
||||||
|
private readonly IServerConfigurationManager _configurationManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SeriesResolver"/> class.
|
/// Initializes a new instance of the <see cref="SeriesResolver"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="namingOptions">The naming options.</param>
|
||||||
public SeriesResolver(ILogger<SeriesResolver> logger, ILibraryManager libraryManager)
|
/// <param name="fileSystem">The file system.</param>
|
||||||
|
/// <param name="configurationManager">The server configuration manager.</param>
|
||||||
|
public SeriesResolver(ILogger<SeriesResolver> logger, NamingOptions namingOptions, IFileSystem fileSystem, IServerConfigurationManager configurationManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_libraryManager = libraryManager;
|
_namingOptions = namingOptions;
|
||||||
|
_fileSystem = fileSystem;
|
||||||
|
_configurationManager = configurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -54,12 +65,13 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var seriesInfo = Naming.TV.SeriesResolver.Resolve(_libraryManager.GetNamingOptions(), args.Path);
|
var seriesInfo = Naming.TV.SeriesResolver.Resolve(_namingOptions, args.Path);
|
||||||
|
|
||||||
var collectionType = args.GetCollectionType();
|
var collectionType = args.GetCollectionType();
|
||||||
if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var configuredContentType = _libraryManager.GetConfiguredContentType(args.Path);
|
// TODO refactor into separate class or something, this is copied from LibraryManager.GetConfiguredContentType
|
||||||
|
var configuredContentType = args.GetConfiguredContentType();
|
||||||
if (!string.Equals(configuredContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(configuredContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return new Series
|
return new Series
|
||||||
|
@ -91,7 +103,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsSeriesFolder(args.Path, args.FileSystemChildren, _logger, _libraryManager, false))
|
if (IsSeriesFolder(args.Path, args.FileSystemChildren, false))
|
||||||
{
|
{
|
||||||
return new Series
|
return new Series
|
||||||
{
|
{
|
||||||
|
@ -105,11 +117,9 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSeriesFolder(
|
private bool IsSeriesFolder(
|
||||||
string path,
|
string path,
|
||||||
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
IEnumerable<FileSystemMetadata> fileSystemChildren,
|
||||||
ILogger<SeriesResolver> logger,
|
|
||||||
ILibraryManager libraryManager,
|
|
||||||
bool isTvContentType)
|
bool isTvContentType)
|
||||||
{
|
{
|
||||||
foreach (var child in fileSystemChildren)
|
foreach (var child in fileSystemChildren)
|
||||||
|
@ -118,21 +128,21 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
{
|
{
|
||||||
if (IsSeasonFolder(child.FullName, isTvContentType))
|
if (IsSeasonFolder(child.FullName, isTvContentType))
|
||||||
{
|
{
|
||||||
logger.LogDebug("{Path} is a series because of season folder {Dir}.", path, child.FullName);
|
_logger.LogDebug("{Path} is a series because of season folder {Dir}.", path, child.FullName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string fullName = child.FullName;
|
string fullName = child.FullName;
|
||||||
if (libraryManager.IsVideoFile(fullName))
|
if (VideoResolver.IsVideoFile(path, _namingOptions))
|
||||||
{
|
{
|
||||||
if (isTvContentType)
|
if (isTvContentType)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions();
|
var namingOptions = _namingOptions;
|
||||||
|
|
||||||
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions);
|
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions);
|
||||||
|
|
||||||
|
@ -145,7 +155,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogDebug("{Path} is not a series folder.", path);
|
_logger.LogDebug("{Path} is not a series folder.", path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -396,20 +396,6 @@ namespace MediaBrowser.Controller.Library
|
||||||
string viewType,
|
string viewType,
|
||||||
string sortName);
|
string sortName);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether [is video file] [the specified path].
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">The path.</param>
|
|
||||||
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
|
||||||
bool IsVideoFile(string path);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether [is audio file] [the specified path].
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">The path.</param>
|
|
||||||
/// <returns><c>true</c> if [is audio file] [the specified path]; otherwise, <c>false</c>.</returns>
|
|
||||||
bool IsAudioFile(string path);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the season number from path.
|
/// Gets the season number from path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -625,11 +611,5 @@ namespace MediaBrowser.Controller.Library
|
||||||
BaseItem GetParentItem(string parentId, Guid? userId);
|
BaseItem GetParentItem(string parentId, Guid? userId);
|
||||||
|
|
||||||
BaseItem GetParentItem(Guid? parentId, Guid? userId);
|
BaseItem GetParentItem(Guid? parentId, Guid? userId);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or creates a static instance of <see cref="NamingOptions"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>An instance of the <see cref="NamingOptions"/> class.</returns>
|
|
||||||
NamingOptions GetNamingOptions();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
DirectoryService = directoryService;
|
DirectoryService = directoryService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO make this shit gone
|
||||||
public IDirectoryService DirectoryService { get; }
|
public IDirectoryService DirectoryService { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -236,6 +237,40 @@ namespace MediaBrowser.Controller.Library
|
||||||
return CollectionType;
|
return CollectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the configured content type for the path.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is subject to future refactoring as it relies on a static property in BaseItem.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The configured content type.</returns>
|
||||||
|
public string GetConfiguredContentType()
|
||||||
|
{
|
||||||
|
return BaseItem.LibraryManager.GetConfiguredContentType(Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the file system children that do not hit the ignore file check.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is subject to future refactoring as it relies on a static property in BaseItem.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The file system children that are not ignored.</returns>
|
||||||
|
public IEnumerable<FileSystemMetadata> GetActualFileSystemChildren()
|
||||||
|
{
|
||||||
|
var numberOfChildren = FileSystemChildren.Length;
|
||||||
|
for (var i = 0; i < numberOfChildren; i++)
|
||||||
|
{
|
||||||
|
var child = FileSystemChildren[i];
|
||||||
|
if (BaseItem.LibraryManager.IgnoreFile(child, Parent))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a hash code for this instance.
|
/// Returns a hash code for this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using Emby.Server.Implementations.Library.Resolvers.TV;
|
||||||
using Emby.Server.Implementations.Library.Resolvers.TV;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
@ -17,19 +16,16 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Resolve_GivenVideoInExtrasFolder_DoesNotResolveToEpisode()
|
public void Resolve_GivenVideoInExtrasFolder_DoesNotResolveToEpisode()
|
||||||
{
|
{
|
||||||
var season = new Season { Name = "Season 1" };
|
|
||||||
var parent = new Folder { Name = "extras" };
|
var parent = new Folder { Name = "extras" };
|
||||||
var libraryManagerMock = new Mock<ILibraryManager>();
|
|
||||||
libraryManagerMock.Setup(x => x.GetItemById(It.IsAny<Guid>())).Returns(season);
|
|
||||||
|
|
||||||
var episodeResolver = new EpisodeResolver(libraryManagerMock.Object);
|
var episodeResolver = new EpisodeResolver(null);
|
||||||
var itemResolveArgs = new ItemResolveArgs(
|
var itemResolveArgs = new ItemResolveArgs(
|
||||||
Mock.Of<IServerApplicationPaths>(),
|
Mock.Of<IServerApplicationPaths>(),
|
||||||
Mock.Of<IDirectoryService>())
|
Mock.Of<IDirectoryService>())
|
||||||
{
|
{
|
||||||
Parent = parent,
|
Parent = parent,
|
||||||
CollectionType = CollectionType.TvShows,
|
CollectionType = CollectionType.TvShows,
|
||||||
FileInfo = new FileSystemMetadata()
|
FileInfo = new FileSystemMetadata
|
||||||
{
|
{
|
||||||
FullName = "All My Children/Season 01/Extras/All My Children S01E01 - Behind The Scenes.mkv"
|
FullName = "All My Children/Season 01/Extras/All My Children S01E01 - Behind The Scenes.mkv"
|
||||||
}
|
}
|
||||||
|
@ -45,7 +41,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
||||||
|
|
||||||
// Have to create a mock because of moq proxies not being castable to a concrete implementation
|
// Have to create a mock because of moq proxies not being castable to a concrete implementation
|
||||||
// https://github.com/jellyfin/jellyfin/blob/ab0cff8556403e123642dc9717ba778329554634/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs#L48
|
// https://github.com/jellyfin/jellyfin/blob/ab0cff8556403e123642dc9717ba778329554634/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs#L48
|
||||||
var episodeResolver = new EpisodeResolverMock(Mock.Of<ILibraryManager>());
|
var episodeResolver = new EpisodeResolverMock();
|
||||||
var itemResolveArgs = new ItemResolveArgs(
|
var itemResolveArgs = new ItemResolveArgs(
|
||||||
Mock.Of<IServerApplicationPaths>(),
|
Mock.Of<IServerApplicationPaths>(),
|
||||||
Mock.Of<IDirectoryService>())
|
Mock.Of<IDirectoryService>())
|
||||||
|
@ -62,7 +58,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
|
||||||
|
|
||||||
private class EpisodeResolverMock : EpisodeResolver
|
private class EpisodeResolverMock : EpisodeResolver
|
||||||
{
|
{
|
||||||
public EpisodeResolverMock(ILibraryManager libraryManager) : base(libraryManager)
|
public EpisodeResolverMock() : base(null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user