@ -14,19 +14,16 @@ namespace NzbDrone.Core.NetImport
public class NetImportFactory : ProviderFactory < INetImport , NetImportDefinition > , INetImportFactory
public class NetImportFactory : ProviderFactory < INetImport , NetImportDefinition > , INetImportFactory
{
{
//private readonly IIndexerStatusService _indexerStatusService;
private readonly INetImportRepository _providerRepository ;
private readonly INetImportRepository _providerRepository ;
private readonly Logger _logger ;
private readonly Logger _logger ;
public NetImportFactory ( //IIndexerStatusService indexerStatusService,
public NetImportFactory ( INetImportRepository providerRepository ,
INetImportRepository providerRepository ,
IEnumerable < INetImport > providers ,
IEnumerable < INetImport > providers ,
IContainer container ,
IContainer container ,
IEventAggregator eventAggregator ,
IEventAggregator eventAggregator ,
Logger logger )
Logger logger )
: base ( providerRepository , providers , container , eventAggregator , logger )
: base ( providerRepository , providers , container , eventAggregator , logger )
{
{
//_indexerStatusService = indexerStatusService;
_providerRepository = providerRepository ;
_providerRepository = providerRepository ;
_logger = logger ;
_logger = logger ;
}
}
@ -43,27 +40,16 @@ namespace NzbDrone.Core.NetImport
public List < INetImport > Enabled ( )
public List < INetImport > Enabled ( )
{
{
var enabledIndexers = GetAvailableProviders ( ) . Where ( n = > ( ( NetImportDefinition ) n . Definition ) . Enabled ) ;
var enabledImporters = GetAvailableProviders ( ) . Where ( n = > ( ( NetImportDefinition ) n . Definition ) . Enabled ) ;
var indexers = FilterBlockedIndexers ( enabledImporters ) ;
var indexers = FilterBlockedIndexers ( enabledIndexers ) ;
return indexers . ToList ( ) ;
return indexers . ToList ( ) ;
}
}
private IEnumerable < INetImport > FilterBlockedIndexers ( IEnumerable < INetImport > i ndex ers)
private IEnumerable < INetImport > FilterBlockedIndexers ( IEnumerable < INetImport > i mport ers)
{
{
//var blockedIndexers = _indexerStatusService.GetBlockedIndexers().ToDictionary(v => v.IndexerId, v => v);
foreach ( var importer in importers )
foreach ( var indexer in indexers )
{
{
/ * IndexerStatus blockedIndexerStatus ;
yield return importer ;
if ( blockedIndexers . TryGetValue ( indexer . Definition . Id , out blockedIndexerStatus ) )
{
_logger . Debug ( "Temporarily ignoring indexer {0} till {1} due to recent failures." , indexer . Definition . Name , blockedIndexerStatus . DisabledTill . Value . ToLocalTime ( ) ) ;
continue ;
} * /
yield return indexer ;
}
}
}
}
}
}