From ca5c20c9889f2c279f0b9d80ce776ddc8ee31ad1 Mon Sep 17 00:00:00 2001 From: crobibero Date: Thu, 3 Dec 2020 07:34:15 -0700 Subject: [PATCH] Remove IIsoMounter and IsoMounter --- .../ApplicationHost.cs | 4 -- Emby.Server.Implementations/IO/IsoManager.cs | 67 ------------------- Jellyfin.Api/Helpers/TranscodingJobHelper.cs | 5 -- .../MediaEncoding/IMediaEncoder.cs | 2 +- .../Encoder/MediaEncoder.cs | 6 +- MediaBrowser.Model/IO/IIsoManager.cs | 35 ---------- MediaBrowser.Model/IO/IIsoMount.cs | 22 ------ MediaBrowser.Model/IO/IIsoMounter.cs | 35 ---------- .../MediaInfo/FFProbeVideoInfo.cs | 2 +- 9 files changed, 4 insertions(+), 174 deletions(-) delete mode 100644 Emby.Server.Implementations/IO/IsoManager.cs delete mode 100644 MediaBrowser.Model/IO/IIsoManager.cs delete mode 100644 MediaBrowser.Model/IO/IIsoMount.cs delete mode 100644 MediaBrowser.Model/IO/IIsoMounter.cs diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 30ccaf8de4..29c93faa62 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -538,8 +538,6 @@ namespace Emby.Server.Implementations ServiceCollection.AddSingleton(NetManager); - ServiceCollection.AddSingleton(); - ServiceCollection.AddSingleton(); ServiceCollection.AddSingleton(_xmlSerializer); @@ -820,8 +818,6 @@ namespace Emby.Server.Implementations Resolve().AddParts(GetExports()); Resolve().AddParts(GetExports(), GetExports()); - - Resolve().AddParts(GetExports()); } /// diff --git a/Emby.Server.Implementations/IO/IsoManager.cs b/Emby.Server.Implementations/IO/IsoManager.cs deleted file mode 100644 index 94e92c2a6a..0000000000 --- a/Emby.Server.Implementations/IO/IsoManager.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Model.IO; - -namespace Emby.Server.Implementations.IO -{ - /// - /// Class IsoManager. - /// - public class IsoManager : IIsoManager - { - /// - /// The _mounters. - /// - private readonly List _mounters = new List(); - - /// - /// Mounts the specified iso path. - /// - /// The iso path. - /// The cancellation token. - /// . - public Task Mount(string isoPath, CancellationToken cancellationToken) - { - if (string.IsNullOrEmpty(isoPath)) - { - throw new ArgumentNullException(nameof(isoPath)); - } - - var mounter = _mounters.FirstOrDefault(i => i.CanMount(isoPath)); - - if (mounter == null) - { - throw new ArgumentException( - string.Format( - CultureInfo.InvariantCulture, - "No mounters are able to mount {0}", - isoPath)); - } - - return mounter.Mount(isoPath, cancellationToken); - } - - /// - /// Determines whether this instance can mount the specified path. - /// - /// The path. - /// true if this instance can mount the specified path; otherwise, false. - public bool CanMount(string path) - { - return _mounters.Any(i => i.CanMount(path)); - } - - /// - /// Adds the parts. - /// - /// The mounters. - public void AddParts(IEnumerable mounters) - { - _mounters.AddRange(mounters); - } - } -} diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs index bb2265dba9..240d132b15 100644 --- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs +++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs @@ -12,7 +12,6 @@ using Jellyfin.Api.Models.PlaybackDtos; using Jellyfin.Api.Models.StreamingDtos; using Jellyfin.Data.Enums; using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; @@ -46,7 +45,6 @@ namespace Jellyfin.Api.Helpers private readonly IAuthorizationContext _authorizationContext; private readonly EncodingHelper _encodingHelper; private readonly IFileSystem _fileSystem; - private readonly IIsoManager _isoManager; private readonly ILogger _logger; private readonly IMediaEncoder _mediaEncoder; private readonly IMediaSourceManager _mediaSourceManager; @@ -64,7 +62,6 @@ namespace Jellyfin.Api.Helpers /// Instance of the interface. /// Instance of the interface. /// Instance of the interface. - /// Instance of the interface. /// Instance of the interface. /// Instance of the interface. /// Instance of the interface. @@ -76,7 +73,6 @@ namespace Jellyfin.Api.Helpers IServerConfigurationManager serverConfigurationManager, ISessionManager sessionManager, IAuthorizationContext authorizationContext, - IIsoManager isoManager, ISubtitleEncoder subtitleEncoder, IConfiguration configuration, ILoggerFactory loggerFactory) @@ -88,7 +84,6 @@ namespace Jellyfin.Api.Helpers _serverConfigurationManager = serverConfigurationManager; _sessionManager = sessionManager; _authorizationContext = authorizationContext; - _isoManager = isoManager; _loggerFactory = loggerFactory; _encodingHelper = new EncodingHelper(mediaEncoder, fileSystem, subtitleEncoder, configuration); diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index e7f042d2f5..34fe895cc4 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -117,6 +117,6 @@ namespace MediaBrowser.Controller.MediaEncoding void UpdateEncoderPath(string path, string pathType); - IEnumerable GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber); + IEnumerable GetPrimaryPlaylistVobFiles(string path, uint? titleNumber); } } diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 3808942788..b1da9c712d 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -949,16 +949,14 @@ namespace MediaBrowser.MediaEncoding.Encoder } /// - public IEnumerable GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber) + public IEnumerable GetPrimaryPlaylistVobFiles(string path, uint? titleNumber) { // min size 300 mb const long MinPlayableSize = 314572800; - var root = isoMount != null ? isoMount.MountedPath : path; - // 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) + var allVobs = _fileSystem.GetFiles(path, true) .Where(file => string.Equals(file.Extension, ".vob", StringComparison.OrdinalIgnoreCase)) .OrderBy(i => i.FullName) .ToList(); diff --git a/MediaBrowser.Model/IO/IIsoManager.cs b/MediaBrowser.Model/IO/IIsoManager.cs deleted file mode 100644 index 299bb0a213..0000000000 --- a/MediaBrowser.Model/IO/IIsoManager.cs +++ /dev/null @@ -1,35 +0,0 @@ -#pragma warning disable CS1591 - -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.IO -{ - public interface IIsoManager - { - /// - /// Mounts the specified iso path. - /// - /// The iso path. - /// The cancellation token. - /// IsoMount. - /// Unable to create mount. - Task Mount(string isoPath, CancellationToken cancellationToken); - - /// - /// Determines whether this instance can mount the specified path. - /// - /// The path. - /// true if this instance can mount the specified path; otherwise, false. - bool CanMount(string path); - - /// - /// Adds the parts. - /// - /// The mounters. - void AddParts(IEnumerable mounters); - } -} diff --git a/MediaBrowser.Model/IO/IIsoMount.cs b/MediaBrowser.Model/IO/IIsoMount.cs deleted file mode 100644 index ea65d976a0..0000000000 --- a/MediaBrowser.Model/IO/IIsoMount.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace MediaBrowser.Model.IO -{ - /// - /// Interface IIsoMount. - /// - public interface IIsoMount : IDisposable - { - /// - /// Gets the iso path. - /// - /// The iso path. - string IsoPath { get; } - - /// - /// Gets the mounted path. - /// - /// The mounted path. - string MountedPath { get; } - } -} diff --git a/MediaBrowser.Model/IO/IIsoMounter.cs b/MediaBrowser.Model/IO/IIsoMounter.cs deleted file mode 100644 index 0d257395a9..0000000000 --- a/MediaBrowser.Model/IO/IIsoMounter.cs +++ /dev/null @@ -1,35 +0,0 @@ -#pragma warning disable CS1591 - -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Model.IO -{ - public interface IIsoMounter - { - /// - /// Gets the name. - /// - /// The name. - string Name { get; } - - /// - /// Mounts the specified iso path. - /// - /// The iso path. - /// The cancellation token. - /// IsoMount. - /// isoPath - /// Unable to create mount. - Task Mount(string isoPath, CancellationToken cancellationToken); - - /// - /// Determines whether this instance can mount the specified path. - /// - /// The path. - /// true if this instance can mount the specified path; otherwise, false. - bool CanMount(string path); - } -} diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 6d39c091ef..74849a5221 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -619,7 +619,7 @@ namespace MediaBrowser.Providers.MediaInfo item.RunTimeTicks = GetRuntime(primaryTitle); } - return _mediaEncoder.GetPrimaryPlaylistVobFiles(item.Path, null, titleNumber) + return _mediaEncoder.GetPrimaryPlaylistVobFiles(item.Path, titleNumber) .Select(Path.GetFileName) .ToArray(); }