@ -7,12 +7,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{
{
public class AvailabilitySpecification : IDecisionEngineSpecification
public class AvailabilitySpecification : IDecisionEngineSpecification
{
{
private readonly IConfigService _ settings Service;
private readonly IConfigService _ config Service;
private readonly Logger _logger ;
private readonly Logger _logger ;
public AvailabilitySpecification ( IConfigService settings Service, Logger logger )
public AvailabilitySpecification ( IConfigService config Service, Logger logger )
{
{
_ settingsService = settings Service;
_ configService = config Service;
_logger = logger ;
_logger = logger ;
}
}
@ -21,18 +21,17 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
public Decision IsSatisfiedBy ( RemoteMovie subject , SearchCriteriaBase searchCriteria )
public Decision IsSatisfiedBy ( RemoteMovie subject , SearchCriteriaBase searchCriteria )
{
{
if ( searchCriteria ! = null )
if ( searchCriteria is { UserInvokedSearch : true } )
{
{
if ( searchCriteria . UserInvokedSearch )
_logger . Debug ( "Skipping availability check during search" ) ;
{
return Decision . Accept ( ) ;
_logger . Debug ( "Skipping availability check during search" ) ;
return Decision . Accept ( ) ;
}
}
}
if ( ! subject . Movie . IsAvailable ( _settingsService . AvailabilityDelay ) )
var availabilityDelay = _configService . AvailabilityDelay ;
if ( ! subject . Movie . IsAvailable ( availabilityDelay ) )
{
{
return Decision . Reject ( "Movie {0} will only be considered available {1} days after {2}" , subject . Movie , _settingsService . AvailabilityDelay , subject . Movie . MinimumAvailability . ToString ( ) ) ;
return Decision . Reject ( "Movie {0} will only be considered available {1} days after {2}" , subject . Movie , a vailabilityDelay, subject . Movie . MinimumAvailability . ToString ( ) ) ;
}
}
return Decision . Accept ( ) ;
return Decision . Accept ( ) ;