aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-30 14:37:42 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-10-30 14:37:42 -0400
commit6d0270db18ca32a0446c2d330931ef103493298a (patch)
tree10830dc947f83687c193e5cfed3247c3d7013d17
parent1031daa9b0ca56cc9f63d4304d2b928ce434c284 (diff)
remove subtitle history
-rw-r--r--MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs44
1 files changed, 1 insertions, 43 deletions
diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs b/MediaBrowser.Providers/MediaInfo/SubtitleScheduledTask.cs
index dd8802689..2df72372a 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.MediaInfo
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)