diff --git a/src/Lidarr.Api.V1/Queue/QueueController.cs b/src/Lidarr.Api.V1/Queue/QueueController.cs index 23808a566..730b50436 100644 --- a/src/Lidarr.Api.V1/Queue/QueueController.cs +++ b/src/Lidarr.Api.V1/Queue/QueueController.cs @@ -130,15 +130,15 @@ public object RemoveMany([FromBody] QueueBulkResource resource, [FromQuery] bool [HttpGet] [Produces("application/json")] - public PagingResource GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownArtistItems = false, bool includeArtist = false, bool includeAlbum = false, [FromQuery] int[] artistIds = null, DownloadProtocol? protocol = null, int? quality = null) + public PagingResource GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownArtistItems = false, bool includeArtist = false, bool includeAlbum = false, [FromQuery] int[] artistIds = null, DownloadProtocol? protocol = null, [FromQuery] int[] quality = null) { var pagingResource = new PagingResource(paging); var pagingSpec = pagingResource.MapToPagingSpec("timeleft", SortDirection.Ascending); - return pagingSpec.ApplyToPage((spec) => GetQueue(spec, artistIds?.ToHashSet(), protocol, quality, includeUnknownArtistItems), (q) => MapToResource(q, includeArtist, includeAlbum)); + return pagingSpec.ApplyToPage((spec) => GetQueue(spec, artistIds?.ToHashSet(), protocol, quality?.ToHashSet(), includeUnknownArtistItems), (q) => MapToResource(q, includeArtist, includeAlbum)); } - private PagingSpec GetQueue(PagingSpec pagingSpec, HashSet artistIds, DownloadProtocol? protocol, int? quality, bool includeUnknownArtistItems) + private PagingSpec GetQueue(PagingSpec pagingSpec, HashSet artistIds, DownloadProtocol? protocol, HashSet quality, bool includeUnknownArtistItems) { var ascending = pagingSpec.SortDirection == SortDirection.Ascending; var orderByFunc = GetOrderByFunc(pagingSpec); @@ -148,6 +148,8 @@ public PagingResource GetQueue([FromQuery] PagingRequestResource var pending = _pendingReleaseService.GetPendingQueue(); var hasArtistIdFilter = artistIds.Any(); + var hasQualityFilter = quality.Any(); + var fullQueue = filteredQueue.Concat(pending).Where(q => { var include = true; @@ -162,9 +164,9 @@ public PagingResource GetQueue([FromQuery] PagingRequestResource include &= q.Protocol == protocol.Value; } - if (include && quality.HasValue) + if (include && hasQualityFilter) { - include &= q.Quality.Quality.Id == quality.Value; + include &= quality.Contains(q.Quality.Quality.Id); } return include;