浏览代码

remove subtitle history

Luke Pulverenti 8 年之前
父节点
当前提交
6d0270db18
共有 1 个文件被更改,包括 1 次插入43 次删除
  1. 1 43
      MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs

+ 1 - 43
MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs

@@ -88,39 +88,17 @@ namespace MediaBrowser.Providers.MediaInfo
             }).OfType<Video>()
             }).OfType<Video>()
                 .ToList();
                 .ToList();
 
 
-            var failHistoryPath = Path.Combine(_config.ApplicationPaths.CachePath, "subtitlehistory.json");
-            var history = GetHistory(failHistoryPath);
-
             var numComplete = 0;
             var numComplete = 0;
 
 
             foreach (var video in videos)
             foreach (var video in videos)
             {
             {
-                DateTime lastAttempt;
-                if (history.TryGetValue(video.Id.ToString("N"), out lastAttempt))
-                {
-                    if ((DateTime.UtcNow - lastAttempt).TotalDays <= 7)
-                    {
-                        continue;
-                    }
-                }
-
                 try
                 try
                 {
                 {
-                    var shouldRetry = await DownloadSubtitles(video, options, cancellationToken).ConfigureAwait(false);
-
-                    if (shouldRetry)
-                    {
-                        history[video.Id.ToString("N")] = DateTime.UtcNow;
-                    }
-                    else
-                    {
-                        history.Remove(video.Id.ToString("N"));
-                    }
+                    await DownloadSubtitles(video, options, cancellationToken).ConfigureAwait(false);
                 }
                 }
                 catch (Exception ex)
                 catch (Exception ex)
                 {
                 {
                     _logger.ErrorException("Error downloading subtitles for {0}", ex, video.Path);
                     _logger.ErrorException("Error downloading subtitles for {0}", ex, video.Path);
-                    history[video.Id.ToString("N")] = DateTime.UtcNow;
                 }
                 }
 
 
                 // Update progress
                 // Update progress
@@ -130,26 +108,6 @@ namespace MediaBrowser.Providers.MediaInfo
 
 
                 progress.Report(100 * percent);
                 progress.Report(100 * percent);
             }
             }
-
-            _json.SerializeToFile(history, failHistoryPath);
-        }
-
-        private Dictionary<string,DateTime> GetHistory(string path)
-        {
-            try
-            {
-                var result = _json.DeserializeFromFile<Dictionary<string, DateTime>>(path);
-
-                if (result != null)
-                {
-                    return result;
-                }
-            }
-            catch
-            {
-            }
-
-            return new Dictionary<string, DateTime>();
         }
         }
 
 
         private async Task<bool> DownloadSubtitles(Video video, SubtitleOptions options, CancellationToken cancellationToken)
         private async Task<bool> DownloadSubtitles(Video video, SubtitleOptions options, CancellationToken cancellationToken)