From debad793ee89c874fd1faa758bb811847948d4ad Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 16 Oct 2017 22:08:49 -0400 Subject: [PATCH] Add ArtistEditedService to handle AlbumType Changes --- .../Music/ArtistEditedService.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/NzbDrone.Core/Music/ArtistEditedService.cs diff --git a/src/NzbDrone.Core/Music/ArtistEditedService.cs b/src/NzbDrone.Core/Music/ArtistEditedService.cs new file mode 100644 index 000000000..cc7d062ba --- /dev/null +++ b/src/NzbDrone.Core/Music/ArtistEditedService.cs @@ -0,0 +1,26 @@ +using NzbDrone.Core.Messaging.Commands; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Music.Commands; +using NzbDrone.Core.Music.Events; + +namespace NzbDrone.Core.Music +{ + public class ArtistEditedService : IHandle + { + private readonly IManageCommandQueue _commandQueueManager; + + public ArtistEditedService(IManageCommandQueue commandQueueManager) + { + _commandQueueManager = commandQueueManager; + } + + public void Handle(ArtistEditedEvent message) + { + // Refresh Artist is we change AlbumType Preferences + if (message.Artist.PrimaryAlbumTypes != message.OldArtist.PrimaryAlbumTypes || message.Artist.SecondaryAlbumTypes != message.OldArtist.SecondaryAlbumTypes) + { + _commandQueueManager.Push(new RefreshArtistCommand(message.Artist.Id)); + } + } + } +}