mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
rewrite of indexer/episode search
This commit is contained in:
25
NzbDrone.Core/Indexers/IndexerSettingProvider.cs
Normal file
25
NzbDrone.Core/Indexers/IndexerSettingProvider.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public interface IProviderIndexerSetting
|
||||
{
|
||||
TSetting Get<TSetting>(IIndexerBase indexer) where TSetting : IIndexerSetting, new();
|
||||
}
|
||||
|
||||
public class IndexerSettingProvider : IProviderIndexerSetting
|
||||
{
|
||||
private readonly IIndexerRepository _indexerRepository;
|
||||
|
||||
public IndexerSettingProvider(IIndexerRepository indexerRepository)
|
||||
{
|
||||
_indexerRepository = indexerRepository;
|
||||
}
|
||||
|
||||
public TSetting Get<TSetting>(IIndexerBase indexer) where TSetting : IIndexerSetting, new()
|
||||
{
|
||||
var json = _indexerRepository.Get(indexer.Name).Settings;
|
||||
return JsonConvert.DeserializeObject<TSetting>(json);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user