1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-24 22:36:19 -04:00

Add v5 queue endpoints

This commit is contained in:
Mark McDowall
2025-04-28 15:58:41 -07:00
parent 37cb978f18
commit 642f4f97bc
29 changed files with 1597 additions and 43 deletions
+10 -8
View File
@@ -21,13 +21,14 @@ using Sonarr.Http.Extensions;
using Sonarr.Http.REST;
using Sonarr.Http.REST.Attributes;
#pragma warning disable CS0612
namespace Sonarr.Api.V3.Queue
{
[V3ApiController]
public class QueueController : RestControllerWithSignalR<QueueResource, NzbDrone.Core.Queue.Queue>,
IHandle<QueueUpdatedEvent>, IHandle<PendingReleasesUpdatedEvent>
IHandle<ObsoleteQueueUpdatedEvent>, IHandle<PendingReleasesUpdatedEvent>
{
private readonly IQueueService _queueService;
private readonly IObsoleteQueueService _queueService;
private readonly IPendingReleaseService _pendingReleaseService;
private readonly QualityModelComparer _qualityComparer;
@@ -38,7 +39,7 @@ namespace Sonarr.Api.V3.Queue
private readonly IBlocklistService _blocklistService;
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
IQueueService queueService,
IObsoleteQueueService queueService,
IPendingReleaseService pendingReleaseService,
IQualityProfileService qualityProfileService,
ITrackedDownloadService trackedDownloadService,
@@ -73,7 +74,7 @@ namespace Sonarr.Api.V3.Queue
[RestDeleteById]
public void RemoveAction(int id, bool removeFromClient = true, bool blocklist = false, bool skipRedownload = false, bool changeCategory = false)
{
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
var pendingRelease = _pendingReleaseService.FindPendingQueueItemObsolete(id);
if (pendingRelease != null)
{
@@ -102,7 +103,7 @@ namespace Sonarr.Api.V3.Queue
foreach (var id in resource.Ids)
{
var pendingRelease = _pendingReleaseService.FindPendingQueueItem(id);
var pendingRelease = _pendingReleaseService.FindPendingQueueItemObsolete(id);
if (pendingRelease != null)
{
@@ -175,7 +176,7 @@ namespace Sonarr.Api.V3.Queue
var queue = _queueService.GetQueue();
var filteredQueue = includeUnknownSeriesItems ? queue : queue.Where(q => q.Series != null);
var pending = _pendingReleaseService.GetPendingQueue();
var pending = _pendingReleaseService.GetPendingQueueObsolete();
var hasSeriesIdFilter = seriesIds is { Count: > 0 };
var hasLanguageFilter = languages is { Count: > 0 };
@@ -325,7 +326,7 @@ namespace Sonarr.Api.V3.Queue
_blocklistService.Block(pendingRelease.RemoteEpisode, "Pending release manually blocklisted");
}
_pendingReleaseService.RemovePendingQueueItems(pendingRelease.Id);
_pendingReleaseService.RemovePendingQueueItemsObsolete(pendingRelease.Id);
}
private TrackedDownload Remove(TrackedDownload trackedDownload, bool removeFromClient, bool blocklist, bool skipRedownload, bool changeCategory)
@@ -394,7 +395,7 @@ namespace Sonarr.Api.V3.Queue
}
[NonAction]
public void Handle(QueueUpdatedEvent message)
public void Handle(ObsoleteQueueUpdatedEvent message)
{
BroadcastResourceChange(ModelAction.Sync);
}
@@ -406,3 +407,4 @@ namespace Sonarr.Api.V3.Queue
}
}
}
#pragma warning restore CS0612