mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-02 21:15:05 +00:00
Align DownloadService with upstream
This commit is contained in:
parent
2d1b34c0bf
commit
94383daac5
1 changed files with 12 additions and 5 deletions
|
@ -50,14 +50,22 @@ public DownloadService(IProvideDownloadClient downloadClientProvider,
|
|||
}
|
||||
|
||||
public void DownloadReport(RemoteAlbum remoteAlbum)
|
||||
{
|
||||
var filterBlockedClients = remoteAlbum.Release.PendingReleaseReason == PendingReleaseReason.DownloadClientUnavailable;
|
||||
|
||||
var tags = remoteAlbum.Artist?.Tags;
|
||||
|
||||
var downloadClient = _downloadClientProvider.GetDownloadClient(remoteAlbum.Release.DownloadProtocol, remoteAlbum.Release.IndexerId, filterBlockedClients, tags);
|
||||
|
||||
DownloadReport(remoteAlbum, downloadClient);
|
||||
}
|
||||
|
||||
private void DownloadReport(RemoteAlbum remoteAlbum, IDownloadClient downloadClient)
|
||||
{
|
||||
Ensure.That(remoteAlbum.Artist, () => remoteAlbum.Artist).IsNotNull();
|
||||
Ensure.That(remoteAlbum.Albums, () => remoteAlbum.Albums).HasItems();
|
||||
|
||||
var downloadTitle = remoteAlbum.Release.Title;
|
||||
var filterBlockedClients = remoteAlbum.Release.PendingReleaseReason == PendingReleaseReason.DownloadClientUnavailable;
|
||||
var tags = remoteAlbum.Artist?.Tags;
|
||||
var downloadClient = _downloadClientProvider.GetDownloadClient(remoteAlbum.Release.DownloadProtocol, remoteAlbum.Release.IndexerId, filterBlockedClients, tags);
|
||||
|
||||
if (downloadClient == null)
|
||||
{
|
||||
|
@ -100,8 +108,7 @@ public void DownloadReport(RemoteAlbum remoteAlbum)
|
|||
}
|
||||
catch (ReleaseDownloadException ex)
|
||||
{
|
||||
var http429 = ex.InnerException as TooManyRequestsException;
|
||||
if (http429 != null)
|
||||
if (ex.InnerException is TooManyRequestsException http429)
|
||||
{
|
||||
_indexerStatusService.RecordFailure(remoteAlbum.Release.IndexerId, http429.RetryAfter);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue