Browse Source

finish open subtitle config page

Luke Pulverenti 11 years ago
parent
commit
d5b1730a7a

+ 2 - 2
MediaBrowser.Model/Configuration/ServerConfiguration.cs

@@ -319,7 +319,7 @@ namespace MediaBrowser.Model.Configuration
     public class SubtitleOptions
     public class SubtitleOptions
     {
     {
         public bool RequireExternalSubtitles { get; set; }
         public bool RequireExternalSubtitles { get; set; }
-        public string[] SubtitleDownloadLanguages { get; set; }
+        public string[] DownloadLanguages { get; set; }
         public bool DownloadMovieSubtitles { get; set; }
         public bool DownloadMovieSubtitles { get; set; }
         public bool DownloadEpisodeSubtitles { get; set; }
         public bool DownloadEpisodeSubtitles { get; set; }
 
 
@@ -328,7 +328,7 @@ namespace MediaBrowser.Model.Configuration
 
 
         public SubtitleOptions()
         public SubtitleOptions()
         {
         {
-            SubtitleDownloadLanguages = new string[] { };
+            DownloadLanguages = new string[] { };
         }
         }
     }
     }
 }
 }

+ 1 - 1
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -473,7 +473,7 @@ namespace MediaBrowser.Providers.MediaInfo
                     currentStreams,
                     currentStreams,
                     externalSubtitleStreams,
                     externalSubtitleStreams,
                     _config.Configuration.SubtitleOptions.RequireExternalSubtitles,
                     _config.Configuration.SubtitleOptions.RequireExternalSubtitles,
-                    _config.Configuration.SubtitleOptions.SubtitleDownloadLanguages,
+                    _config.Configuration.SubtitleOptions.DownloadLanguages,
                     cancellationToken).ConfigureAwait(false);
                     cancellationToken).ConfigureAwait(false);
 
 
                 // Rescan
                 // Rescan

+ 8 - 0
MediaBrowser.Providers/Subtitles/OpenSubtitleDownloader.cs

@@ -127,8 +127,14 @@ namespace MediaBrowser.Providers.Subtitles
             };
             };
         }
         }
 
 
+        private DateTime _lastLogin;
         private async Task Login(CancellationToken cancellationToken)
         private async Task Login(CancellationToken cancellationToken)
         {
         {
+            if ((DateTime.UtcNow - _lastLogin).TotalSeconds < 60)
+            {
+                return;
+            }
+
             var options = _config.Configuration.SubtitleOptions ?? new SubtitleOptions();
             var options = _config.Configuration.SubtitleOptions ?? new SubtitleOptions();
 
 
             var user = options.OpenSubtitlesUsername ?? string.Empty;
             var user = options.OpenSubtitlesUsername ?? string.Empty;
@@ -140,6 +146,8 @@ namespace MediaBrowser.Providers.Subtitles
             {
             {
                 throw new UnauthorizedAccessException("Authentication to OpenSubtitles failed.");
                 throw new UnauthorizedAccessException("Authentication to OpenSubtitles failed.");
             }
             }
+
+            _lastLogin = DateTime.UtcNow;
         }
         }
 
 
         public async Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)
         public async Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)

+ 4 - 1
MediaBrowser.Server.Implementations/Localization/Server/server.json

@@ -712,5 +712,8 @@
 	"TabSubtitles": "Subtitles",
 	"TabSubtitles": "Subtitles",
 	"LabelOpenSubtitlesUsername": "Open Subtitles username:",
 	"LabelOpenSubtitlesUsername": "Open Subtitles username:",
 	"LabelOpenSubtitlesPassword": "Open Subtitles password:",
 	"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."
 }
 }

+ 2 - 1
MediaBrowser.ServerApplication/MainStartup.cs

@@ -111,6 +111,7 @@ namespace MediaBrowser.ServerApplication
         /// <summary>
         /// <summary>
         /// Determines whether [is already running] [the specified current process].
         /// Determines whether [is already running] [the specified current process].
         /// </summary>
         /// </summary>
+        /// <param name="applicationPath">The application path.</param>
         /// <param name="currentProcess">The current process.</param>
         /// <param name="currentProcess">The current process.</param>
         /// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns>
         /// <returns><c>true</c> if [is already running] [the specified current process]; otherwise, <c>false</c>.</returns>
         private static bool IsAlreadyRunning(string applicationPath, Process currentProcess)
         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.");
                 _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.");
                     _logger.Info("The duplicate process did not exit.");
                     return true;
                     return true;