Fixed: Search for newly added movie if disk rescanning is disabled after refresh

(cherry picked from commit 00ab449ebeb53893b8d4c939e072451845a4d69e)

Closes #7543
pull/9067/head
Mark McDowall 2 years ago committed by Bogdan
parent 3412e4139e
commit d9e337f2fb

@ -1,4 +1,4 @@
using NzbDrone.Common.Messaging; using NzbDrone.Common.Messaging;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
namespace NzbDrone.Core.MediaFiles.Events namespace NzbDrone.Core.MediaFiles.Events
@ -19,6 +19,8 @@ namespace NzbDrone.Core.MediaFiles.Events
{ {
RootFolderDoesNotExist, RootFolderDoesNotExist,
RootFolderIsEmpty, RootFolderIsEmpty,
MovieFolderDoesNotExist MovieFolderDoesNotExist,
NeverRescanAfterRefresh,
RescanAfterManualRefreshOnly
} }
} }

@ -7,6 +7,7 @@ using NzbDrone.Core.AutoTagging;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Exceptions; using NzbDrone.Core.Exceptions;
using NzbDrone.Core.MediaFiles; using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.MetadataSource; using NzbDrone.Core.MetadataSource;
@ -172,26 +173,23 @@ namespace NzbDrone.Core.Movies
private void RescanMovie(Movie movie, bool isNew, CommandTrigger trigger) private void RescanMovie(Movie movie, bool isNew, CommandTrigger trigger)
{ {
var rescanAfterRefresh = _configService.RescanAfterRefresh; var rescanAfterRefresh = _configService.RescanAfterRefresh;
var shouldRescan = true;
if (isNew) if (isNew)
{ {
_logger.Trace("Forcing rescan of {0}. Reason: New movie", movie); _logger.Trace("Forcing rescan of {0}. Reason: New movie", movie);
shouldRescan = true;
} }
else if (rescanAfterRefresh == RescanAfterRefreshType.Never) else if (rescanAfterRefresh == RescanAfterRefreshType.Never)
{ {
_logger.Trace("Skipping rescan of {0}. Reason: Never rescan after refresh", movie); _logger.Trace("Skipping rescan of {0}. Reason: Never rescan after refresh", movie);
shouldRescan = false; _eventAggregator.PublishEvent(new MovieScanSkippedEvent(movie, MovieScanSkippedReason.NeverRescanAfterRefresh));
return;
} }
else if (rescanAfterRefresh == RescanAfterRefreshType.AfterManual && trigger != CommandTrigger.Manual) else if (rescanAfterRefresh == RescanAfterRefreshType.AfterManual && trigger != CommandTrigger.Manual)
{ {
_logger.Trace("Skipping rescan of {0}. Reason: Not after automatic scans", movie); _logger.Trace("Skipping rescan of {0}. Reason: Not after automatic scans", movie);
shouldRescan = false; _eventAggregator.PublishEvent(new MovieScanSkippedEvent(movie, MovieScanSkippedReason.RescanAfterManualRefreshOnly));
}
if (!shouldRescan)
{
return; return;
} }

Loading…
Cancel
Save