diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 32b1a7e015..ae801f53f2 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -319,7 +319,7 @@ namespace MediaBrowser.Model.Configuration public class SubtitleOptions { public bool RequireExternalSubtitles { get; set; } - public string[] SubtitleDownloadLanguages { get; set; } + public string[] DownloadLanguages { get; set; } public bool DownloadMovieSubtitles { get; set; } public bool DownloadEpisodeSubtitles { get; set; } @@ -328,7 +328,7 @@ namespace MediaBrowser.Model.Configuration public SubtitleOptions() { - SubtitleDownloadLanguages = new string[] { }; + DownloadLanguages = new string[] { }; } } } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index a2897ef9c2..ad222aca5c 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -473,7 +473,7 @@ namespace MediaBrowser.Providers.MediaInfo currentStreams, externalSubtitleStreams, _config.Configuration.SubtitleOptions.RequireExternalSubtitles, - _config.Configuration.SubtitleOptions.SubtitleDownloadLanguages, + _config.Configuration.SubtitleOptions.DownloadLanguages, cancellationToken).ConfigureAwait(false); // Rescan diff --git a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs index f76528c3f4..ac0439737b 100644 --- a/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs +++ b/MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs @@ -127,8 +127,14 @@ namespace MediaBrowser.Providers.Subtitles }; } + private DateTime _lastLogin; private async Task Login(CancellationToken cancellationToken) { + if ((DateTime.UtcNow - _lastLogin).TotalSeconds < 60) + { + return; + } + var options = _config.Configuration.SubtitleOptions ?? new SubtitleOptions(); var user = options.OpenSubtitlesUsername ?? string.Empty; @@ -140,6 +146,8 @@ namespace MediaBrowser.Providers.Subtitles { throw new UnauthorizedAccessException("Authentication to OpenSubtitles failed."); } + + _lastLogin = DateTime.UtcNow; } public async Task> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken) diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index d011d45d06..5f128ea227 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -712,5 +712,8 @@ "TabSubtitles": "Subtitles", "LabelOpenSubtitlesUsername": "Open Subtitles username:", "LabelOpenSubtitlesPassword": "Open Subtitles password:", - "LabelAudioLanguagePreferenceHelp": "If empty, the default audio track will be selected, regardless of language." + "LabelAudioLanguagePreferenceHelp": "If empty, the default audio track will be selected, regardless of language.", + "LabelDownloadLanguages": "Download languages:", + "ButtonRegister": "Register", + "HeaderSubtitleDownloadingMoreHelp": "Subtitles are considered missing when the audio track is in a foreign language, and there are no subtitles available in the preferred language." } \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index d8bd3938e5..6dcbf00e35 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -111,6 +111,7 @@ namespace MediaBrowser.ServerApplication /// /// Determines whether [is already running] [the specified current process]. /// + /// The application path. /// The current process. /// true if [is already running] [the specified current process]; otherwise, false. private static bool IsAlreadyRunning(string applicationPath, Process currentProcess) @@ -131,7 +132,7 @@ namespace MediaBrowser.ServerApplication { _logger.Info("Found a duplicate process. Giving it time to exit."); - if (!duplicate.WaitForExit(5000)) + if (!duplicate.WaitForExit(10000)) { _logger.Info("The duplicate process did not exit."); return true;