mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-20 18:02:44 +01:00
New: Add download client name to pending items waiting for a specific client
(cherry picked from commit 3cd4c67ba12cd5e8cc00d3df8929555fc0ad5918) Closes #9676
This commit is contained in:
parent
25b77eb4a2
commit
0ecb1d0706
@ -44,8 +44,10 @@ public class PendingReleaseService : IPendingReleaseService,
|
||||
private readonly IDelayProfileService _delayProfileService;
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IRemoteMovieAggregationService _aggregationService;
|
||||
private readonly ICustomFormatCalculationService _formatCalculator;
|
||||
private readonly IRemoteMovieAggregationService _aggregationService;
|
||||
private readonly IDownloadClientFactory _downloadClientFactory;
|
||||
private readonly IIndexerFactory _indexerFactory;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly Logger _logger;
|
||||
|
||||
@ -56,8 +58,10 @@ public PendingReleaseService(IIndexerStatusService indexerStatusService,
|
||||
IDelayProfileService delayProfileService,
|
||||
ITaskManager taskManager,
|
||||
IConfigService configService,
|
||||
IRemoteMovieAggregationService aggregationService,
|
||||
ICustomFormatCalculationService formatCalculator,
|
||||
IRemoteMovieAggregationService aggregationService,
|
||||
IDownloadClientFactory downloadClientFactory,
|
||||
IIndexerFactory indexerFactory,
|
||||
IEventAggregator eventAggregator,
|
||||
Logger logger)
|
||||
{
|
||||
@ -68,8 +72,10 @@ public PendingReleaseService(IIndexerStatusService indexerStatusService,
|
||||
_delayProfileService = delayProfileService;
|
||||
_taskManager = taskManager;
|
||||
_configService = configService;
|
||||
_aggregationService = aggregationService;
|
||||
_formatCalculator = formatCalculator;
|
||||
_aggregationService = aggregationService;
|
||||
_downloadClientFactory = downloadClientFactory;
|
||||
_indexerFactory = indexerFactory;
|
||||
_eventAggregator = eventAggregator;
|
||||
_logger = logger;
|
||||
}
|
||||
@ -101,9 +107,16 @@ public void AddMany(List<Tuple<DownloadDecision, PendingReleaseReason>> decision
|
||||
|
||||
if (matchingReport.Reason != reason)
|
||||
{
|
||||
_logger.Debug("The release {0} is already pending with reason {1}, changing to {2}", decision.RemoteMovie, matchingReport.Reason, reason);
|
||||
matchingReport.Reason = reason;
|
||||
_repository.Update(matchingReport);
|
||||
if (matchingReport.Reason == PendingReleaseReason.DownloadClientUnavailable)
|
||||
{
|
||||
_logger.Debug("The release {0} is already pending with reason {1}, not changing reason", decision.RemoteMovie, matchingReport.Reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("The release {0} is already pending with reason {1}, changing to {2}", decision.RemoteMovie, matchingReport.Reason, reason);
|
||||
matchingReport.Reason = reason;
|
||||
_repository.Update(matchingReport);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -191,6 +204,16 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
||||
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
|
||||
{
|
||||
Id = GetQueueId(pendingRelease, pendingRelease.RemoteMovie.Movie),
|
||||
@ -206,7 +229,8 @@ public List<RemoteMovie> GetPendingRemoteMovies(int movieId)
|
||||
Added = pendingRelease.Added,
|
||||
Status = pendingRelease.Reason.ToString(),
|
||||
Protocol = pendingRelease.RemoteMovie.Release.DownloadProtocol,
|
||||
Indexer = pendingRelease.RemoteMovie.Release.Indexer
|
||||
Indexer = pendingRelease.RemoteMovie.Release.Indexer,
|
||||
DownloadClient = downloadClientName
|
||||
};
|
||||
|
||||
queued.Add(queue);
|
||||
|
Loading…
Reference in New Issue
Block a user