diff --git a/src/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs b/src/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs index 52e3e093f..3a9ccab3a 100644 --- a/src/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs @@ -111,7 +111,7 @@ namespace NzbDrone.Core.Test.MediaCoverTests .Setup(v => v.FileExists(It.IsAny())) .Returns(true); - Subject.HandleAsync(new ArtistUpdatedEvent(_artist)); + Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist)); Mocker.GetMock() .Verify(v => v.Resize(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(3)); @@ -132,7 +132,7 @@ namespace NzbDrone.Core.Test.MediaCoverTests .Setup(v => v.FileExists(It.IsAny())) .Returns(false); - Subject.HandleAsync(new ArtistUpdatedEvent(_artist)); + Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist)); Mocker.GetMock() .Verify(v => v.Resize(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(3)); @@ -157,7 +157,7 @@ namespace NzbDrone.Core.Test.MediaCoverTests .Setup(v => v.GetFileSize(It.IsAny())) .Returns(1000); - Subject.HandleAsync(new ArtistUpdatedEvent(_artist)); + Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist)); Mocker.GetMock() .Verify(v => v.Resize(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never()); @@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.MediaCoverTests .Setup(v => v.GetFileSize(It.IsAny())) .Returns(0); - Subject.HandleAsync(new ArtistUpdatedEvent(_artist)); + Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist)); Mocker.GetMock() .Verify(v => v.Resize(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(3)); @@ -207,7 +207,7 @@ namespace NzbDrone.Core.Test.MediaCoverTests .Setup(v => v.Resize(It.IsAny(), It.IsAny(), It.IsAny())) .Throws(); - Subject.HandleAsync(new ArtistUpdatedEvent(_artist)); + Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist)); Mocker.GetMock() .Verify(v => v.Resize(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(3)); diff --git a/src/NzbDrone.Core/MediaCover/MediaCoverService.cs b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs index 09aa0a8d2..5ed16207d 100644 --- a/src/NzbDrone.Core/MediaCover/MediaCoverService.cs +++ b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.MediaCover } public class MediaCoverService : - IHandleAsync, + IHandleAsync, IHandleAsync, IMapCoversToLocal { @@ -287,7 +287,7 @@ namespace NzbDrone.Core.MediaCover } } - public void HandleAsync(ArtistUpdatedEvent message) + public void HandleAsync(ArtistRefreshCompleteEvent message) { EnsureArtistCovers(message.Artist); diff --git a/src/NzbDrone.Core/Music/Events/ArtistRefreshCompleteEvent.cs b/src/NzbDrone.Core/Music/Events/ArtistRefreshCompleteEvent.cs new file mode 100644 index 000000000..5214be4c3 --- /dev/null +++ b/src/NzbDrone.Core/Music/Events/ArtistRefreshCompleteEvent.cs @@ -0,0 +1,14 @@ +using NzbDrone.Common.Messaging; + +namespace NzbDrone.Core.Music.Events +{ + public class ArtistRefreshCompleteEvent : IEvent + { + public Artist Artist { get; set; } + + public ArtistRefreshCompleteEvent(Artist artist) + { + Artist = artist; + } + } +} diff --git a/src/NzbDrone.Core/Music/Events/ArtistRefreshStartingEvent.cs b/src/NzbDrone.Core/Music/Events/ArtistRefreshStartingEvent.cs deleted file mode 100644 index 45d9a50c8..000000000 --- a/src/NzbDrone.Core/Music/Events/ArtistRefreshStartingEvent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using NzbDrone.Common.Messaging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace NzbDrone.Core.Music.Events -{ - public class ArtistRefreshStartingEvent : IEvent - { - public bool ManualTrigger { get; set; } - - public ArtistRefreshStartingEvent(bool manualTrigger) - { - ManualTrigger = manualTrigger; - } - } -} diff --git a/src/NzbDrone.Core/Music/RefreshArtistService.cs b/src/NzbDrone.Core/Music/RefreshArtistService.cs index 82a7d47af..30f8477db 100644 --- a/src/NzbDrone.Core/Music/RefreshArtistService.cs +++ b/src/NzbDrone.Core/Music/RefreshArtistService.cs @@ -247,6 +247,11 @@ namespace NzbDrone.Core.Music _eventAggregator.PublishEvent(new ArtistUpdatedEvent(entity)); } + protected virtual void PublishRefreshCompleteEvent(Artist entity) + { + _eventAggregator.PublishEvent(new ArtistRefreshCompleteEvent(entity)); + } + protected override void PublishChildrenUpdatedEvent(Artist entity, List newChildren, List updateChildren) { _eventAggregator.PublishEvent(new AlbumInfoRefreshedEvent(entity, newChildren, updateChildren)); @@ -297,7 +302,6 @@ namespace NzbDrone.Core.Music { var trigger = message.Trigger; var isNew = message.IsNewArtist; - _eventAggregator.PublishEvent(new ArtistRefreshStartingEvent(trigger == CommandTrigger.Manual)); if (message.ArtistId.HasValue) { diff --git a/src/NzbDrone.Core/Music/RefreshEntityServiceBase.cs b/src/NzbDrone.Core/Music/RefreshEntityServiceBase.cs index bbc7b8e49..50b504886 100644 --- a/src/NzbDrone.Core/Music/RefreshEntityServiceBase.cs +++ b/src/NzbDrone.Core/Music/RefreshEntityServiceBase.cs @@ -100,7 +100,11 @@ namespace NzbDrone.Core.Music protected virtual void PublishEntityUpdatedEvent(Entity entity) { } - + + protected virtual void PublishRefreshCompleteEvent(Entity entity) + { + } + protected virtual void PublishChildrenUpdatedEvent(Entity entity, List newChildren, List updateChildren) { } @@ -185,6 +189,8 @@ namespace NzbDrone.Core.Music PublishEntityUpdatedEvent(local); } + PublishRefreshCompleteEvent(local); + _logger.Debug($"Finished {typeof(Entity).Name} refresh for {local}"); return updated; diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 9f2d9badd..aa4c8e78d 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -893,7 +893,7 @@ - +