The Free Software Media System - Server Backend & API
remove subtitle history
Luke Pulverenti6d0270db18ca
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.csindex dd88026895..2df72372aa 100644--- a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs+++ b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs@@ -88,39 +88,17 @@ namespace MediaBrowser.Providers.MediaInfo}).OfType<Video>().ToList();- var failHistoryPath = Path.Combine(_config.ApplicationPaths.CachePath, "subtitlehistory.json");- var history = GetHistory(failHistoryPath);-var numComplete = 0;foreach (var video in videos){- DateTime lastAttempt;- if (history.TryGetValue(video.Id.ToString("N"), out lastAttempt))- {- if ((DateTime.UtcNow - lastAttempt).TotalDays <= 7)- {- continue;- }- }-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){_logger.ErrorException("Error downloading subtitles for {0}", ex, video.Path);- history[video.Id.ToString("N")] = DateTime.UtcNow;}// Update progress@@ -130,26 +108,6 @@ namespace MediaBrowser.Providers.MediaInfoprogress.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)