mirror of
https://github.com/Radarr/Radarr
synced 2025-01-19 14:11:40 +00:00
parent
ca164c2a24
commit
816c62979a
1 changed files with 11 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace NzbDrone.Core.Tv
|
||||
{
|
||||
|
@ -46,6 +47,7 @@ public class MovieService : IMovieService, IHandle<MovieFileAddedEvent>,
|
|||
IHandle<MovieFileDeletedEvent>
|
||||
{
|
||||
private readonly IMovieRepository _movieRepository;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IBuildFileNames _fileNameBuilder;
|
||||
private readonly Logger _logger;
|
||||
|
@ -55,11 +57,13 @@ public MovieService(IMovieRepository movieRepository,
|
|||
ISceneMappingService sceneMappingService,
|
||||
IEpisodeService episodeService,
|
||||
IBuildFileNames fileNameBuilder,
|
||||
IConfigService configService,
|
||||
Logger logger)
|
||||
{
|
||||
_movieRepository = movieRepository;
|
||||
_eventAggregator = eventAggregator;
|
||||
_fileNameBuilder = fileNameBuilder;
|
||||
_configService = configService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -297,8 +301,15 @@ public void Handle(MovieFileAddedEvent message)
|
|||
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
{
|
||||
|
||||
var movie = _movieRepository.GetMoviesByFileId(message.MovieFile.Id).First();
|
||||
movie.MovieFileId = 0;
|
||||
_logger.Debug("Detaching movie {0} from file.", movie.Id);
|
||||
|
||||
if (message.Reason != DeleteMediaFileReason.Upgrade && _configService.AutoUnmonitorPreviouslyDownloadedEpisodes)
|
||||
{
|
||||
movie.Monitored = false;
|
||||
}
|
||||
|
||||
UpdateMovie(movie);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue