mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 04:59:35 -07:00
Fixed: No Artist images when adding single Album
This commit is contained in:
parent
05de0c0f4c
commit
8e9a85557e
3 changed files with 22 additions and 6 deletions
|
@ -5,12 +5,12 @@ namespace NzbDrone.Core.Music.Events
|
||||||
{
|
{
|
||||||
public class ArtistsImportedEvent : IEvent
|
public class ArtistsImportedEvent : IEvent
|
||||||
{
|
{
|
||||||
public List<int> ArtistIds { get; private set; }
|
public List<Artist> Artists { get; private set; }
|
||||||
public bool DoRefresh { get; private set; }
|
public bool DoRefresh { get; private set; }
|
||||||
|
|
||||||
public ArtistsImportedEvent(List<int> artistIds, bool doRefresh = true)
|
public ArtistsImportedEvent(List<Artist> artists, bool doRefresh = true)
|
||||||
{
|
{
|
||||||
ArtistIds = artistIds;
|
Artists = artists;
|
||||||
DoRefresh = doRefresh;
|
DoRefresh = doRefresh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Linq;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Music.Commands;
|
using NzbDrone.Core.Music.Commands;
|
||||||
|
@ -9,10 +10,12 @@ namespace NzbDrone.Core.Music
|
||||||
IHandle<ArtistsImportedEvent>
|
IHandle<ArtistsImportedEvent>
|
||||||
{
|
{
|
||||||
private readonly IManageCommandQueue _commandQueueManager;
|
private readonly IManageCommandQueue _commandQueueManager;
|
||||||
|
private readonly IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
public ArtistAddedHandler(IManageCommandQueue commandQueueManager)
|
public ArtistAddedHandler(IManageCommandQueue commandQueueManager, IEventAggregator eventAggregator)
|
||||||
{
|
{
|
||||||
_commandQueueManager = commandQueueManager;
|
_commandQueueManager = commandQueueManager;
|
||||||
|
_eventAggregator = eventAggregator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(ArtistAddedEvent message)
|
public void Handle(ArtistAddedEvent message)
|
||||||
|
@ -21,13 +24,26 @@ namespace NzbDrone.Core.Music
|
||||||
{
|
{
|
||||||
_commandQueueManager.Push(new RefreshArtistCommand(message.Artist.Id, true));
|
_commandQueueManager.Push(new RefreshArtistCommand(message.Artist.Id, true));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Trigger Artist Metadata download when adding Albums
|
||||||
|
_eventAggregator.PublishEvent(new ArtistRefreshCompleteEvent(message.Artist));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Handle(ArtistsImportedEvent message)
|
public void Handle(ArtistsImportedEvent message)
|
||||||
{
|
{
|
||||||
if (message.DoRefresh)
|
if (message.DoRefresh)
|
||||||
{
|
{
|
||||||
_commandQueueManager.Push(new BulkRefreshArtistCommand(message.ArtistIds, true));
|
_commandQueueManager.Push(new BulkRefreshArtistCommand(message.Artists.Select(a => a.Id).ToList(), true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Trigger Artist Metadata download when adding Albums
|
||||||
|
foreach (var artist in message.Artists)
|
||||||
|
{
|
||||||
|
_eventAggregator.PublishEvent(new ArtistRefreshCompleteEvent(artist));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Music
|
||||||
{
|
{
|
||||||
_cache.Clear();
|
_cache.Clear();
|
||||||
_artistRepository.InsertMany(newArtists);
|
_artistRepository.InsertMany(newArtists);
|
||||||
_eventAggregator.PublishEvent(new ArtistsImportedEvent(newArtists.Select(s => s.Id).ToList(), doRefresh));
|
_eventAggregator.PublishEvent(new ArtistsImportedEvent(newArtists.ToList(), doRefresh));
|
||||||
|
|
||||||
return newArtists;
|
return newArtists;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue