mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
fixed schema support for indexers
This commit is contained in:
parent
0eec2cd5f7
commit
4f9b745e70
3 changed files with 29 additions and 21 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Reflection;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
|
@ -17,6 +18,7 @@ namespace NzbDrone.Core.ThingiProvider
|
|||
TProviderDefinition Create(TProviderDefinition indexer);
|
||||
void Update(TProviderDefinition indexer);
|
||||
void Delete(int id);
|
||||
List<TProviderDefinition> Templates();
|
||||
}
|
||||
|
||||
public abstract class ProviderFactory<TProvider, TProviderDefinition> : IProviderFactory<TProvider, TProviderDefinition>, IHandle<ApplicationStartedEvent>
|
||||
|
@ -40,6 +42,16 @@ namespace NzbDrone.Core.ThingiProvider
|
|||
return _providerRepository.All().ToList();
|
||||
}
|
||||
|
||||
public List<TProviderDefinition> Templates()
|
||||
{
|
||||
return _providers.Select(p => new TProviderDefinition()
|
||||
{
|
||||
ConfigContract = p.ConfigContract.Name,
|
||||
Implementation = p.GetType().Name,
|
||||
Settings = (IProviderConfig)Activator.CreateInstance(ReflectionExtensions.CoreAssembly.FindTypeByName(p.ConfigContract.Name))
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<TProvider> GetAvailableProviders()
|
||||
{
|
||||
return All().Where(c => c.Enable && c.Settings.Validate().IsValid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue