diff --git a/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs b/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs
deleted file mode 100644
index 0445397ad8..0000000000
--- a/MediaBrowser.Common/Providers/SubtitleConfigurationFactory.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma warning disable CS1591
-
-using System.Collections.Generic;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Providers;
-
-namespace MediaBrowser.Common.Providers
-{
- public class SubtitleConfigurationFactory : IConfigurationFactory
- {
- ///
- public IEnumerable GetConfigurations()
- {
- yield return new ConfigurationStore()
- {
- Key = "subtitles",
- ConfigurationType = typeof(SubtitleOptions)
- };
- }
- }
-}
diff --git a/MediaBrowser.Model/Providers/SubtitleOptions.cs b/MediaBrowser.Model/Providers/SubtitleOptions.cs
deleted file mode 100644
index 6ea1e14862..0000000000
--- a/MediaBrowser.Model/Providers/SubtitleOptions.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-#nullable disable
-#pragma warning disable CS1591
-
-using System;
-
-namespace MediaBrowser.Model.Providers
-{
- public class SubtitleOptions
- {
- public SubtitleOptions()
- {
- DownloadLanguages = Array.Empty();
-
- SkipIfAudioTrackMatches = true;
- RequirePerfectMatch = true;
- }
-
- public bool SkipIfEmbeddedSubtitlesPresent { get; set; }
-
- public bool SkipIfAudioTrackMatches { get; set; }
-
- public string[] DownloadLanguages { get; set; }
-
- public bool DownloadMovieSubtitles { get; set; }
-
- public bool DownloadEpisodeSubtitles { get; set; }
-
- public string OpenSubtitlesUsername { get; set; }
-
- public string OpenSubtitlesPasswordHash { get; set; }
-
- public bool IsOpenSubtitleVipAccount { get; set; }
-
- public bool RequirePerfectMatch { get; set; }
- }
-}
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
index a89f059060..fdc2f36469 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
@@ -8,7 +8,6 @@ using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
-using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Chapters;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
@@ -25,7 +24,6 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.MediaInfo;
-using MediaBrowser.Model.Providers;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Providers.MediaInfo
@@ -74,7 +72,6 @@ namespace MediaBrowser.Providers.MediaInfo
_subtitleResolver = subtitleResolver;
_mediaAttachmentRepository = mediaAttachmentRepository;
_mediaStreamRepository = mediaStreamRepository;
- _mediaStreamRepository = mediaStreamRepository;
}
public async Task ProbeVideo(
@@ -551,47 +548,19 @@ namespace MediaBrowser.Providers.MediaInfo
var enableSubtitleDownloading = options.MetadataRefreshMode == MetadataRefreshMode.Default ||
options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh;
- var subtitleOptions = _config.GetConfiguration("subtitles");
-
var libraryOptions = _libraryManager.GetLibraryOptions(video);
- string[] subtitleDownloadLanguages;
- bool skipIfEmbeddedSubtitlesPresent;
- bool skipIfAudioTrackMatches;
- bool requirePerfectMatch;
- bool enabled;
-
- if (libraryOptions.SubtitleDownloadLanguages is null)
- {
- subtitleDownloadLanguages = subtitleOptions.DownloadLanguages;
- skipIfEmbeddedSubtitlesPresent = subtitleOptions.SkipIfEmbeddedSubtitlesPresent;
- skipIfAudioTrackMatches = subtitleOptions.SkipIfAudioTrackMatches;
- requirePerfectMatch = subtitleOptions.RequirePerfectMatch;
- enabled = (subtitleOptions.DownloadEpisodeSubtitles &&
- video is Episode) ||
- (subtitleOptions.DownloadMovieSubtitles &&
- video is Movie);
- }
- else
- {
- subtitleDownloadLanguages = libraryOptions.SubtitleDownloadLanguages;
- skipIfEmbeddedSubtitlesPresent = libraryOptions.SkipSubtitlesIfEmbeddedSubtitlesPresent;
- skipIfAudioTrackMatches = libraryOptions.SkipSubtitlesIfAudioTrackMatches;
- requirePerfectMatch = libraryOptions.RequirePerfectSubtitleMatch;
- enabled = true;
- }
-
- if (enableSubtitleDownloading && enabled)
+ if (enableSubtitleDownloading && libraryOptions.SubtitleDownloadLanguages is not null)
{
var downloadedLanguages = await new SubtitleDownloader(
_logger,
_subtitleManager).DownloadSubtitles(
video,
currentStreams.Concat(externalSubtitleStreams).ToList(),
- skipIfEmbeddedSubtitlesPresent,
- skipIfAudioTrackMatches,
- requirePerfectMatch,
- subtitleDownloadLanguages,
+ libraryOptions.SkipSubtitlesIfEmbeddedSubtitlesPresent,
+ libraryOptions.SkipSubtitlesIfAudioTrackMatches,
+ libraryOptions.RequirePerfectSubtitleMatch,
+ libraryOptions.SubtitleDownloadLanguages,
libraryOptions.DisabledSubtitleFetchers,
libraryOptions.SubtitleFetcherOrder,
true,
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
index 1134baf92d..7188e9804e 100644
--- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
+++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
@@ -8,14 +8,12 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Enums;
-using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Subtitles;
using MediaBrowser.Model.Globalization;
-using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
@@ -57,16 +55,9 @@ namespace MediaBrowser.Providers.MediaInfo
public bool IsLogged => true;
- private SubtitleOptions GetOptions()
- {
- return _config.GetConfiguration("subtitles");
- }
-
///
public async Task ExecuteAsync(IProgress progress, CancellationToken cancellationToken)
{
- var options = GetOptions();
-
var types = new[] { BaseItemKind.Episode, BaseItemKind.Movie };
var dict = new Dictionary();
@@ -81,17 +72,14 @@ namespace MediaBrowser.Providers.MediaInfo
if (libraryOptions.SubtitleDownloadLanguages is null)
{
- subtitleDownloadLanguages = options.DownloadLanguages;
- skipIfEmbeddedSubtitlesPresent = options.SkipIfEmbeddedSubtitlesPresent;
- skipIfAudioTrackMatches = options.SkipIfAudioTrackMatches;
- }
- else
- {
- subtitleDownloadLanguages = libraryOptions.SubtitleDownloadLanguages;
- skipIfEmbeddedSubtitlesPresent = libraryOptions.SkipSubtitlesIfEmbeddedSubtitlesPresent;
- skipIfAudioTrackMatches = libraryOptions.SkipSubtitlesIfAudioTrackMatches;
+ // Skip this library if subtitle download languages are not configured
+ continue;
}
+ subtitleDownloadLanguages = libraryOptions.SubtitleDownloadLanguages;
+ skipIfEmbeddedSubtitlesPresent = libraryOptions.SkipSubtitlesIfEmbeddedSubtitlesPresent;
+ skipIfAudioTrackMatches = libraryOptions.SkipSubtitlesIfAudioTrackMatches;
+
foreach (var lang in subtitleDownloadLanguages)
{
var query = new InternalItemsQuery
@@ -144,7 +132,7 @@ namespace MediaBrowser.Providers.MediaInfo
try
{
- await DownloadSubtitles(video as Video, options, cancellationToken).ConfigureAwait(false);
+ await DownloadSubtitles(video as Video, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -160,7 +148,7 @@ namespace MediaBrowser.Providers.MediaInfo
}
}
- private async Task DownloadSubtitles(Video video, SubtitleOptions options, CancellationToken cancellationToken)
+ private async Task DownloadSubtitles(Video video, CancellationToken cancellationToken)
{
var mediaStreams = video.GetMediaStreams();
@@ -173,19 +161,15 @@ namespace MediaBrowser.Providers.MediaInfo
if (libraryOptions.SubtitleDownloadLanguages is null)
{
- subtitleDownloadLanguages = options.DownloadLanguages;
- skipIfEmbeddedSubtitlesPresent = options.SkipIfEmbeddedSubtitlesPresent;
- skipIfAudioTrackMatches = options.SkipIfAudioTrackMatches;
- requirePerfectMatch = options.RequirePerfectMatch;
- }
- else
- {
- subtitleDownloadLanguages = libraryOptions.SubtitleDownloadLanguages;
- skipIfEmbeddedSubtitlesPresent = libraryOptions.SkipSubtitlesIfEmbeddedSubtitlesPresent;
- skipIfAudioTrackMatches = libraryOptions.SkipSubtitlesIfAudioTrackMatches;
- requirePerfectMatch = libraryOptions.RequirePerfectSubtitleMatch;
+ // Subtitle downloading is not configured for this library
+ return true;
}
+ subtitleDownloadLanguages = libraryOptions.SubtitleDownloadLanguages;
+ skipIfEmbeddedSubtitlesPresent = libraryOptions.SkipSubtitlesIfEmbeddedSubtitlesPresent;
+ skipIfAudioTrackMatches = libraryOptions.SkipSubtitlesIfAudioTrackMatches;
+ requirePerfectMatch = libraryOptions.RequirePerfectSubtitleMatch;
+
var downloadedLanguages = await new SubtitleDownloader(
_logger,
_subtitleManager).DownloadSubtitles(