Use depencency injection for ISubtitleProvider
This commit is contained in:
parent
8898012121
commit
4f81f4daaa
|
@ -728,8 +728,6 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
Resolve<ILiveTvManager>().AddParts(GetExports<ILiveTvService>(), GetExports<ITunerHost>(), GetExports<IListingsProvider>());
|
Resolve<ILiveTvManager>().AddParts(GetExports<ILiveTvService>(), GetExports<ITunerHost>(), GetExports<IListingsProvider>());
|
||||||
|
|
||||||
Resolve<ISubtitleManager>().AddParts(GetExports<ISubtitleProvider>());
|
|
||||||
|
|
||||||
Resolve<IChannelManager>().AddParts(GetExports<IChannel>());
|
Resolve<IChannelManager>().AddParts(GetExports<IChannel>());
|
||||||
|
|
||||||
Resolve<IMediaSourceManager>().AddParts(GetExports<IMediaSourceProvider>());
|
Resolve<IMediaSourceManager>().AddParts(GetExports<IMediaSourceProvider>());
|
||||||
|
|
|
@ -19,12 +19,6 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
/// </summary>
|
/// </summary>
|
||||||
event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
|
event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds the parts.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="subtitleProviders">The subtitle providers.</param>
|
|
||||||
void AddParts(IEnumerable<ISubtitleProvider> subtitleProviders);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Searches the subtitles.
|
/// Searches the subtitles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -35,33 +35,29 @@ namespace MediaBrowser.Providers.Subtitles
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
|
|
||||||
private ISubtitleProvider[] _subtitleProviders;
|
private readonly ISubtitleProvider[] _subtitleProviders;
|
||||||
|
|
||||||
public SubtitleManager(
|
public SubtitleManager(
|
||||||
ILogger<SubtitleManager> logger,
|
ILogger<SubtitleManager> logger,
|
||||||
IFileSystem fileSystem,
|
IFileSystem fileSystem,
|
||||||
ILibraryMonitor monitor,
|
ILibraryMonitor monitor,
|
||||||
IMediaSourceManager mediaSourceManager,
|
IMediaSourceManager mediaSourceManager,
|
||||||
ILocalizationManager localizationManager)
|
ILocalizationManager localizationManager,
|
||||||
|
IEnumerable<ISubtitleProvider> subtitleProviders)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_fileSystem = fileSystem;
|
_fileSystem = fileSystem;
|
||||||
_monitor = monitor;
|
_monitor = monitor;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_localization = localizationManager;
|
_localization = localizationManager;
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public void AddParts(IEnumerable<ISubtitleProvider> subtitleProviders)
|
|
||||||
{
|
|
||||||
_subtitleProviders = subtitleProviders
|
_subtitleProviders = subtitleProviders
|
||||||
.OrderBy(i => i is IHasOrder hasOrder ? hasOrder.Order : 0)
|
.OrderBy(i => i is IHasOrder hasOrder ? hasOrder.Order : 0)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public event EventHandler<SubtitleDownloadFailureEventArgs> SubtitleDownloadFailure;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
public async Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user