You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
using System.Collections.Generic;
|
|
using Lidarr.Http.REST;
|
|
using NzbDrone.Core.Music;
|
|
using NzbDrone.Core.ArtistStats;
|
|
using NzbDrone.Core.DecisionEngine;
|
|
using NzbDrone.SignalR;
|
|
|
|
namespace NzbDrone.Api.Albums
|
|
{
|
|
public class AlbumModule : AlbumModuleWithSignalR
|
|
{
|
|
public AlbumModule(IArtistService artistService,
|
|
IArtistStatisticsService artistStatisticsService,
|
|
IAlbumService albumService,
|
|
IUpgradableSpecification qualityUpgradableSpecification,
|
|
IBroadcastSignalRMessage signalRBroadcaster)
|
|
: base(albumService, artistStatisticsService, artistService, qualityUpgradableSpecification, signalRBroadcaster)
|
|
{
|
|
GetResourceAll = GetAlbums;
|
|
UpdateResource = SetMonitored;
|
|
}
|
|
|
|
private List<AlbumResource> GetAlbums()
|
|
{
|
|
if (!Request.Query.ArtistId.HasValue)
|
|
{
|
|
throw new BadRequestException("artistId is missing");
|
|
}
|
|
|
|
var artistId = (int)Request.Query.ArtistId;
|
|
|
|
var resources = MapToResource(_albumService.GetAlbumsByArtist(artistId), false);
|
|
|
|
return resources;
|
|
}
|
|
|
|
private void SetMonitored(AlbumResource albumResource)
|
|
{
|
|
_albumService.SetAlbumMonitored(albumResource.Id, albumResource.Monitored);
|
|
}
|
|
}
|
|
}
|