fixes #2588 - OpenSubtitlesDownloader doesn't respect X-Ratelimit-Requests-Remaining

This commit is contained in:
Luke Pulverenti
2017-06-22 15:14:58 -04:00
parent e7706fa8a3
commit 6ff89eab78
4 changed files with 34 additions and 4 deletions

View File

@@ -136,7 +136,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
if ((DateTime.UtcNow - _lastRateLimitException).TotalHours < 1)
{
throw new Exception("OpenSubtitles rate limit reached");
throw new RateLimitExceededException("OpenSubtitles rate limit reached");
}
var resultDownLoad = await OpenSubtitles.DownloadSubtitlesAsync(downloadsList, cancellationToken).ConfigureAwait(false);
@@ -144,7 +144,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
if ((resultDownLoad.Status ?? string.Empty).IndexOf("407", StringComparison.OrdinalIgnoreCase) != -1)
{
_lastRateLimitException = DateTime.UtcNow;
throw new Exception("OpenSubtitles rate limit reached");
throw new RateLimitExceededException("OpenSubtitles rate limit reached");
}
if (!(resultDownLoad is MethodResponseSubtitleDownload))