mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 05:23:31 -07:00
[UI Work] History, Queue, Calendar Fixes
This commit is contained in:
parent
d2bafd4605
commit
871a3773b2
17 changed files with 91 additions and 122 deletions
|
@ -27,16 +27,28 @@ namespace Lidarr.Api.V3.Albums
|
|||
|
||||
private List<AlbumResource> GetAlbums()
|
||||
{
|
||||
if (!Request.Query.ArtistId.HasValue)
|
||||
var artistIdQuery = Request.Query.ArtistId;
|
||||
var albumIdsQuery = Request.Query.AlbumIds;
|
||||
|
||||
if (!Request.Query.ArtistId.HasValue && !albumIdsQuery.HasValue)
|
||||
{
|
||||
throw new BadRequestException("artistId is missing");
|
||||
throw new BadRequestException("artistId or albumIds must be provided");
|
||||
}
|
||||
|
||||
var artistId = (int)Request.Query.ArtistId;
|
||||
if (artistIdQuery.HasValue)
|
||||
{
|
||||
int artistId = Convert.ToInt32(artistIdQuery.Value);
|
||||
|
||||
var resources = MapToResource(_albumService.GetAlbumsByArtist(artistId), false);
|
||||
return MapToResource(_albumService.GetAlbumsByArtist(artistId), false);
|
||||
}
|
||||
|
||||
return resources;
|
||||
string episodeIdsValue = albumIdsQuery.Value.ToString();
|
||||
|
||||
var episodeIds = episodeIdsValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(e => Convert.ToInt32(e))
|
||||
.ToList();
|
||||
|
||||
return MapToResource(_albumService.GetAlbums(episodeIds), false);
|
||||
}
|
||||
|
||||
private Response SetAlbumMonitored(int id)
|
||||
|
|
|
@ -33,23 +33,23 @@ namespace Lidarr.Api.V3.Queue
|
|||
var pending = _pendingReleaseService.GetPendingQueue();
|
||||
var fullQueue = queue.Concat(pending);
|
||||
|
||||
var seriesIdQuery = Request.Query.SeriesId;
|
||||
var episodeIdsQuery = Request.Query.EpisodeIds;
|
||||
var artistIdQuery = Request.Query.ArtistId;
|
||||
var albumIdsQuery = Request.Query.AlbumIds;
|
||||
|
||||
if (seriesIdQuery.HasValue)
|
||||
if (artistIdQuery.HasValue)
|
||||
{
|
||||
return fullQueue.Where(q => q.Artist.Id == (int)seriesIdQuery).ToResource(includeSeries, includeEpisode);
|
||||
return fullQueue.Where(q => q.Artist.Id == (int)artistIdQuery).ToResource(includeSeries, includeEpisode);
|
||||
}
|
||||
|
||||
if (episodeIdsQuery.HasValue)
|
||||
if (albumIdsQuery.HasValue)
|
||||
{
|
||||
string episodeIdsValue = episodeIdsQuery.Value.ToString();
|
||||
string albumIdsValue = albumIdsQuery.Value.ToString();
|
||||
|
||||
var episodeIds = episodeIdsValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
var albumIds = albumIdsValue.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(e => Convert.ToInt32(e))
|
||||
.ToList();
|
||||
|
||||
return fullQueue.Where(q => episodeIds.Contains(q.Episode.Id)).ToResource(includeSeries, includeEpisode);
|
||||
return fullQueue.Where(q => albumIds.Contains(q.Album.Id)).ToResource(includeSeries, includeEpisode);
|
||||
}
|
||||
|
||||
return fullQueue.ToResource(includeSeries, includeEpisode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue