Fixed: Make artist stats update when album (un)monitored (#673)

pull/685/head
ta264 6 years ago committed by GitHub
parent 072f772dc8
commit bf32512fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save