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

This commit is contained in:
Mark McDowall 2022-08-11 17:27:49 -07:00
parent a3e2299011
commit 00ab449ebe
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
using NzbDrone.Common.Messaging; using NzbDrone.Common.Messaging;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
namespace NzbDrone.Core.MediaFiles.Events namespace NzbDrone.Core.MediaFiles.Events
@ -18,6 +18,8 @@ namespace NzbDrone.Core.MediaFiles.Events
public enum SeriesScanSkippedReason public enum SeriesScanSkippedReason
{ {
RootFolderDoesNotExist, RootFolderDoesNotExist,
RootFolderIsEmpty RootFolderIsEmpty,
NeverRescanAfterRefresh,
RescanAfterManualRefreshOnly
} }
} }

View File

@ -8,6 +8,7 @@ using NzbDrone.Common.Instrumentation.Extensions;
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;
@ -157,26 +158,23 @@ namespace NzbDrone.Core.Tv
private void RescanSeries(Series series, bool isNew, CommandTrigger trigger) private void RescanSeries(Series series, 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 series", series); _logger.Trace("Forcing rescan of {0}. Reason: New series", series);
shouldRescan = true;
} }
else if (rescanAfterRefresh == RescanAfterRefreshType.Never) else if (rescanAfterRefresh == RescanAfterRefreshType.Never)
{ {
_logger.Trace("Skipping rescan of {0}. Reason: never rescan after refresh", series); _logger.Trace("Skipping rescan of {0}. Reason: never rescan after refresh", series);
shouldRescan = false; _eventAggregator.PublishEvent(new SeriesScanSkippedEvent(series, SeriesScanSkippedReason.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", series); _logger.Trace("Skipping rescan of {0}. Reason: not after automatic scans", series);
shouldRescan = false; _eventAggregator.PublishEvent(new SeriesScanSkippedEvent(series, SeriesScanSkippedReason.RescanAfterManualRefreshOnly));
}
if (!shouldRescan)
{
return; return;
} }