|
|
@ -8,6 +8,7 @@ using NzbDrone.Common.EnvironmentInfo;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Messaging.Commands;
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
using NzbDrone.Core.Messaging.Events;
|
|
|
|
using NzbDrone.Core.Movies;
|
|
|
|
using NzbDrone.Core.Movies;
|
|
|
|
using NzbDrone.Core.Movies.Events;
|
|
|
|
using NzbDrone.Core.Movies.Events;
|
|
|
@ -24,6 +25,7 @@ namespace NzbDrone.Core.MediaCover
|
|
|
|
IHandleAsync<MovieUpdatedEvent>,
|
|
|
|
IHandleAsync<MovieUpdatedEvent>,
|
|
|
|
IHandleAsync<MovieAddedEvent>,
|
|
|
|
IHandleAsync<MovieAddedEvent>,
|
|
|
|
IHandleAsync<MovieDeletedEvent>,
|
|
|
|
IHandleAsync<MovieDeletedEvent>,
|
|
|
|
|
|
|
|
IExecute<EnsureMediaCoversCommand>,
|
|
|
|
IMapCoversToLocal
|
|
|
|
IMapCoversToLocal
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IImageResizer _resizer;
|
|
|
|
private readonly IImageResizer _resizer;
|
|
|
@ -32,6 +34,8 @@ namespace NzbDrone.Core.MediaCover
|
|
|
|
private readonly ICoverExistsSpecification _coverExistsSpecification;
|
|
|
|
private readonly ICoverExistsSpecification _coverExistsSpecification;
|
|
|
|
private readonly IConfigFileProvider _configFileProvider;
|
|
|
|
private readonly IConfigFileProvider _configFileProvider;
|
|
|
|
private readonly IEventAggregator _eventAggregator;
|
|
|
|
private readonly IEventAggregator _eventAggregator;
|
|
|
|
|
|
|
|
private readonly IManageCommandQueue _commandQueue;
|
|
|
|
|
|
|
|
private readonly IMovieService _movieService;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly string _coverRootFolder;
|
|
|
|
private readonly string _coverRootFolder;
|
|
|
@ -43,6 +47,8 @@ namespace NzbDrone.Core.MediaCover
|
|
|
|
ICoverExistsSpecification coverExistsSpecification,
|
|
|
|
ICoverExistsSpecification coverExistsSpecification,
|
|
|
|
IConfigFileProvider configFileProvider,
|
|
|
|
IConfigFileProvider configFileProvider,
|
|
|
|
IEventAggregator eventAggregator,
|
|
|
|
IEventAggregator eventAggregator,
|
|
|
|
|
|
|
|
IManageCommandQueue commandQueue,
|
|
|
|
|
|
|
|
IMovieService movieService,
|
|
|
|
Logger logger)
|
|
|
|
Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_resizer = resizer;
|
|
|
|
_resizer = resizer;
|
|
|
@ -51,6 +57,8 @@ namespace NzbDrone.Core.MediaCover
|
|
|
|
_coverExistsSpecification = coverExistsSpecification;
|
|
|
|
_coverExistsSpecification = coverExistsSpecification;
|
|
|
|
_configFileProvider = configFileProvider;
|
|
|
|
_configFileProvider = configFileProvider;
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
_eventAggregator = eventAggregator;
|
|
|
|
|
|
|
|
_commandQueue = commandQueue;
|
|
|
|
|
|
|
|
_movieService = movieService;
|
|
|
|
_logger = logger;
|
|
|
|
_logger = logger;
|
|
|
|
|
|
|
|
|
|
|
|
_coverRootFolder = appFolderInfo.GetMediaCoverPath();
|
|
|
|
_coverRootFolder = appFolderInfo.GetMediaCoverPath();
|
|
|
@ -182,16 +190,25 @@ namespace NzbDrone.Core.MediaCover
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Execute(EnsureMediaCoversCommand command)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var movie = _movieService.GetMovie(command.MovieId);
|
|
|
|
|
|
|
|
EnsureCovers(movie);
|
|
|
|
|
|
|
|
_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(movie));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HandleAsync(MovieUpdatedEvent message)
|
|
|
|
public void HandleAsync(MovieUpdatedEvent message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
EnsureCovers(message.Movie);
|
|
|
|
//EnsureCovers(message.Movie);
|
|
|
|
_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
|
|
|
_commandQueue.Push(new EnsureMediaCoversCommand(message.Movie.Id));
|
|
|
|
|
|
|
|
//_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HandleAsync(MovieAddedEvent message)
|
|
|
|
public void HandleAsync(MovieAddedEvent message)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
EnsureCovers(message.Movie);
|
|
|
|
//EnsureCovers(message.Movie);
|
|
|
|
_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
|
|
|
_commandQueue.Push(new EnsureMediaCoversCommand(message.Movie.Id));
|
|
|
|
|
|
|
|
//_eventAggregator.PublishEvent(new MediaCoversUpdatedEvent(message.Movie));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HandleAsync(MovieDeletedEvent message)
|
|
|
|
public void HandleAsync(MovieDeletedEvent message)
|
|
|
|