mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-02-05 07:27:11 +00:00
Fixed: Make artist stats update when album (un)monitored (#673)
This commit is contained in:
@@ -25,6 +25,7 @@ namespace Lidarr.Api.V1.Artist
|
||||
{
|
||||
public class ArtistModule : LidarrRestModuleWithSignalR<ArtistResource, NzbDrone.Core.Music.Artist>,
|
||||
IHandle<AlbumImportedEvent>,
|
||||
IHandle<AlbumEditedEvent>,
|
||||
IHandle<TrackFileDeletedEvent>,
|
||||
IHandle<ArtistUpdatedEvent>,
|
||||
IHandle<ArtistEditedEvent>,
|
||||
@@ -242,6 +243,11 @@ namespace Lidarr.Api.V1.Artist
|
||||
BroadcastResourceChange(ModelAction.Updated, GetArtistResource(message.Artist));
|
||||
}
|
||||
|
||||
public void Handle(AlbumEditedEvent message)
|
||||
{
|
||||
BroadcastResourceChange(ModelAction.Updated, GetArtistResource(message.Album.Artist.Value));
|
||||
}
|
||||
|
||||
public void Handle(TrackFileDeletedEvent message)
|
||||
{
|
||||
if (message.Reason == DeleteMediaFileReason.Upgrade) return;
|
||||
|
||||
@@ -282,12 +282,21 @@ namespace NzbDrone.Core.Music
|
||||
var album = _albumRepository.Get(albumId);
|
||||
_albumRepository.SetMonitoredFlat(album, monitored);
|
||||
|
||||
// publish album edited event so artist stats update
|
||||
_eventAggregator.PublishEvent(new AlbumEditedEvent(album, album));
|
||||
|
||||
_logger.Debug("Monitored flag for Album:{0} was set to {1}", albumId, monitored);
|
||||
}
|
||||
|
||||
public void SetMonitored(IEnumerable<int> ids, bool monitored)
|
||||
{
|
||||
_albumRepository.SetMonitored(ids, monitored);
|
||||
|
||||
// publish album edited event so artist stats update
|
||||
foreach (var album in _albumRepository.Get(ids))
|
||||
{
|
||||
_eventAggregator.PublishEvent(new AlbumEditedEvent(album, album));
|
||||
}
|
||||
}
|
||||
|
||||
public List<Album> UpdateAlbums(List<Album> albums)
|
||||
|
||||
Reference in New Issue
Block a user