mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Fixed: Make artist stats update when album (un)monitored (#673)
This commit is contained in:
parent
072f772dc8
commit
bf32512fa2
2 changed files with 15 additions and 0 deletions
|
@ -25,6 +25,7 @@ namespace Lidarr.Api.V1.Artist
|
||||||
{
|
{
|
||||||
public class ArtistModule : LidarrRestModuleWithSignalR<ArtistResource, NzbDrone.Core.Music.Artist>,
|
public class ArtistModule : LidarrRestModuleWithSignalR<ArtistResource, NzbDrone.Core.Music.Artist>,
|
||||||
IHandle<AlbumImportedEvent>,
|
IHandle<AlbumImportedEvent>,
|
||||||
|
IHandle<AlbumEditedEvent>,
|
||||||
IHandle<TrackFileDeletedEvent>,
|
IHandle<TrackFileDeletedEvent>,
|
||||||
IHandle<ArtistUpdatedEvent>,
|
IHandle<ArtistUpdatedEvent>,
|
||||||
IHandle<ArtistEditedEvent>,
|
IHandle<ArtistEditedEvent>,
|
||||||
|
@ -242,6 +243,11 @@ namespace Lidarr.Api.V1.Artist
|
||||||
BroadcastResourceChange(ModelAction.Updated, GetArtistResource(message.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)
|
public void Handle(TrackFileDeletedEvent message)
|
||||||
{
|
{
|
||||||
if (message.Reason == DeleteMediaFileReason.Upgrade) return;
|
if (message.Reason == DeleteMediaFileReason.Upgrade) return;
|
||||||
|
|
|
@ -282,12 +282,21 @@ namespace NzbDrone.Core.Music
|
||||||
var album = _albumRepository.Get(albumId);
|
var album = _albumRepository.Get(albumId);
|
||||||
_albumRepository.SetMonitoredFlat(album, monitored);
|
_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);
|
_logger.Debug("Monitored flag for Album:{0} was set to {1}", albumId, monitored);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMonitored(IEnumerable<int> ids, bool monitored)
|
public void SetMonitored(IEnumerable<int> ids, bool monitored)
|
||||||
{
|
{
|
||||||
_albumRepository.SetMonitored(ids, 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)
|
public List<Album> UpdateAlbums(List<Album> albums)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue