using System.Collections.Generic; using System.Linq; using NLog; using NzbDrone.Common.Composition; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { public interface IIndexerFactory : IProviderFactory { List RssEnabled(); List SearchEnabled(); } public class IndexerFactory : ProviderFactory, IIndexerFactory { private readonly IIndexerRepository _providerRepository; public IndexerFactory(IIndexerRepository providerRepository, IEnumerable providers, IContainer container, IEventAggregator eventAggregator, Logger logger) : base(providerRepository, providers, container, eventAggregator, logger) { _providerRepository = providerRepository; } protected override void InitializeProviders() { //_providerRepository.DeleteImplementations("Animezb"); } protected override List Active() { return base.Active().Where(c => c.Enable).ToList(); } public override IndexerDefinition GetProviderCharacteristics(IIndexer provider, IndexerDefinition definition) { definition = base.GetProviderCharacteristics(provider, definition); definition.Protocol = provider.Protocol; definition.SupportsRss = provider.SupportsRss; definition.SupportsSearch = provider.SupportsSearch; return definition; } public List RssEnabled() { return GetAvailableProviders().Where(n => ((IndexerDefinition)n.Definition).EnableRss).ToList(); } public List SearchEnabled() { return GetAvailableProviders().Where(n => ((IndexerDefinition)n.Definition).EnableSearch).ToList(); } } }