New: Add download client name to pending items waiting for a specific client
Closes #6274
This commit is contained in:
parent
fc3a2e9ab2
commit
3cd4c67ba1
|
@ -46,6 +46,8 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly ICustomFormatCalculationService _formatCalculator;
|
private readonly ICustomFormatCalculationService _formatCalculator;
|
||||||
private readonly IRemoteEpisodeAggregationService _aggregationService;
|
private readonly IRemoteEpisodeAggregationService _aggregationService;
|
||||||
|
private readonly IDownloadClientFactory _downloadClientFactory;
|
||||||
|
private readonly IIndexerFactory _indexerFactory;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
@ -58,6 +60,8 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
IConfigService configService,
|
IConfigService configService,
|
||||||
ICustomFormatCalculationService formatCalculator,
|
ICustomFormatCalculationService formatCalculator,
|
||||||
IRemoteEpisodeAggregationService aggregationService,
|
IRemoteEpisodeAggregationService aggregationService,
|
||||||
|
IDownloadClientFactory downloadClientFactory,
|
||||||
|
IIndexerFactory indexerFactory,
|
||||||
IEventAggregator eventAggregator,
|
IEventAggregator eventAggregator,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
|
@ -70,6 +74,8 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
_configService = configService;
|
_configService = configService;
|
||||||
_formatCalculator = formatCalculator;
|
_formatCalculator = formatCalculator;
|
||||||
_aggregationService = aggregationService;
|
_aggregationService = aggregationService;
|
||||||
|
_downloadClientFactory = downloadClientFactory;
|
||||||
|
_indexerFactory = indexerFactory;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
@ -107,9 +113,16 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
|
|
||||||
if (matchingReport.Reason != reason)
|
if (matchingReport.Reason != reason)
|
||||||
{
|
{
|
||||||
_logger.Debug("The release {0} is already pending with reason {1}, changing to {2}", decision.RemoteEpisode, matchingReport.Reason, reason);
|
if (matchingReport.Reason == PendingReleaseReason.DownloadClientUnavailable)
|
||||||
matchingReport.Reason = reason;
|
{
|
||||||
_repository.Update(matchingReport);
|
_logger.Debug("The release {0} is already pending with reason {1}, not changing reason", decision.RemoteEpisode, matchingReport.Reason);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Debug("The release {0} is already pending with reason {1}, changing to {2}", decision.RemoteEpisode, matchingReport.Reason, reason);
|
||||||
|
matchingReport.Reason = reason;
|
||||||
|
_repository.Update(matchingReport);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -355,6 +368,16 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
timeleft = TimeSpan.Zero;
|
timeleft = TimeSpan.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string downloadClientName = null;
|
||||||
|
var indexer = _indexerFactory.Find(pendingRelease.Release.IndexerId);
|
||||||
|
|
||||||
|
if (indexer is { DownloadClientId: > 0 })
|
||||||
|
{
|
||||||
|
var downloadClient = _downloadClientFactory.Find(indexer.DownloadClientId);
|
||||||
|
|
||||||
|
downloadClientName = downloadClient?.Name;
|
||||||
|
}
|
||||||
|
|
||||||
var queue = new Queue.Queue
|
var queue = new Queue.Queue
|
||||||
{
|
{
|
||||||
Id = GetQueueId(pendingRelease, episode),
|
Id = GetQueueId(pendingRelease, episode),
|
||||||
|
@ -371,7 +394,8 @@ namespace NzbDrone.Core.Download.Pending
|
||||||
Added = pendingRelease.Added,
|
Added = pendingRelease.Added,
|
||||||
Status = pendingRelease.Reason.ToString(),
|
Status = pendingRelease.Reason.ToString(),
|
||||||
Protocol = pendingRelease.RemoteEpisode.Release.DownloadProtocol,
|
Protocol = pendingRelease.RemoteEpisode.Release.DownloadProtocol,
|
||||||
Indexer = pendingRelease.RemoteEpisode.Release.Indexer
|
Indexer = pendingRelease.RemoteEpisode.Release.Indexer,
|
||||||
|
DownloadClient = downloadClientName
|
||||||
};
|
};
|
||||||
|
|
||||||
return queue;
|
return queue;
|
||||||
|
|
Loading…
Reference in New Issue