mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
New: Readarr 0.1
This commit is contained in:
@@ -33,23 +33,23 @@ namespace Readarr.Api.V1.Queue
|
||||
var pending = _pendingReleaseService.GetPendingQueue();
|
||||
var fullQueue = queue.Concat(pending);
|
||||
|
||||
var artistIdQuery = Request.Query.ArtistId;
|
||||
var albumIdsQuery = Request.Query.AlbumIds;
|
||||
var authorIdQuery = Request.Query.AuthorId;
|
||||
var bookIdsQuery = Request.Query.BookIds;
|
||||
|
||||
if (artistIdQuery.HasValue)
|
||||
if (authorIdQuery.HasValue)
|
||||
{
|
||||
return fullQueue.Where(q => q.Artist?.Id == (int)artistIdQuery).ToResource(includeArtist, includeAlbum);
|
||||
return fullQueue.Where(q => q.Artist?.Id == (int)authorIdQuery).ToResource(includeArtist, includeAlbum);
|
||||
}
|
||||
|
||||
if (albumIdsQuery.HasValue)
|
||||
if (bookIdsQuery.HasValue)
|
||||
{
|
||||
string albumIdsValue = albumIdsQuery.Value.ToString();
|
||||
string bookIdsValue = bookIdsQuery.Value.ToString();
|
||||
|
||||
var albumIds = albumIdsValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
var bookIds = bookIdsValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(e => Convert.ToInt32(e))
|
||||
.ToList();
|
||||
|
||||
return fullQueue.Where(q => q.Album != null && albumIds.Contains(q.Album.Id)).ToResource(includeArtist, includeAlbum);
|
||||
return fullQueue.Where(q => q.Album != null && bookIds.Contains(q.Album.Id)).ToResource(includeArtist, includeAlbum);
|
||||
}
|
||||
|
||||
return fullQueue.ToResource(includeArtist, includeAlbum);
|
||||
|
||||
@@ -118,13 +118,13 @@ namespace Readarr.Api.V1.Queue
|
||||
{
|
||||
case "status":
|
||||
return q => q.Status;
|
||||
case "artist.sortName":
|
||||
case "authors.sortName":
|
||||
return q => q.Artist?.SortName;
|
||||
case "title":
|
||||
return q => q.Title;
|
||||
case "album":
|
||||
return q => q.Album;
|
||||
case "album.title":
|
||||
case "books.title":
|
||||
return q => q.Album?.Title;
|
||||
case "album.releaseDate":
|
||||
return q => q.Album?.ReleaseDate;
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Readarr.Api.V1.Queue
|
||||
{
|
||||
public class QueueResource : RestResource
|
||||
{
|
||||
public int? ArtistId { get; set; }
|
||||
public int? AlbumId { get; set; }
|
||||
public int? AuthorId { get; set; }
|
||||
public int? BookId { get; set; }
|
||||
public ArtistResource Artist { get; set; }
|
||||
public AlbumResource Album { get; set; }
|
||||
public QualityModel Quality { get; set; }
|
||||
@@ -48,8 +48,8 @@ namespace Readarr.Api.V1.Queue
|
||||
return new QueueResource
|
||||
{
|
||||
Id = model.Id,
|
||||
ArtistId = model.Artist?.Id,
|
||||
AlbumId = model.Album?.Id,
|
||||
AuthorId = model.Artist?.Id,
|
||||
BookId = model.Album?.Id,
|
||||
Artist = includeArtist && model.Artist != null ? model.Artist.ToResource() : null,
|
||||
Album = includeAlbum && model.Album != null ? model.Album.ToResource() : null,
|
||||
Quality = model.Quality,
|
||||
|
||||
Reference in New Issue
Block a user