Fixed: Broadcast album updated if track file deleted

Ensures that album stats update in the Artist details page if track files
are deleted.
This commit is contained in:
ta264 2019-10-29 21:27:27 +00:00 committed by Qstick
parent d9dfd32568
commit 75e2ace49e
1 changed files with 10 additions and 1 deletions

View File

@ -13,6 +13,7 @@ using NzbDrone.Core.Download;
using NzbDrone.Core.Music.Events;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MediaFiles;
namespace Lidarr.Api.V1.Albums
{
@ -20,7 +21,8 @@ namespace Lidarr.Api.V1.Albums
IHandle<AlbumGrabbedEvent>,
IHandle<AlbumEditedEvent>,
IHandle<AlbumImportedEvent>,
IHandle<TrackImportedEvent>
IHandle<TrackImportedEvent>,
IHandle<TrackFileDeletedEvent>
{
protected readonly IReleaseService _releaseService;
@ -129,5 +131,12 @@ namespace Lidarr.Api.V1.Albums
{
BroadcastResourceChange(ModelAction.Updated, message.TrackInfo.Album.ToResource());
}
public void Handle(TrackFileDeletedEvent message)
{
if (message.Reason == DeleteMediaFileReason.Upgrade) return;
BroadcastResourceChange(ModelAction.Updated, MapToResource(message.TrackFile.Album.Value, true));
}
}
}