mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-24 22:55:21 -04:00
New: Alternative Site Links
This commit is contained in:
@@ -14,14 +14,14 @@ using NzbDrone.Core.ThingiProvider;
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public abstract class IndexerBase<TSettings> : IIndexer
|
||||
where TSettings : IProviderConfig, new()
|
||||
where TSettings : IIndexerSettings, new()
|
||||
{
|
||||
protected readonly IIndexerStatusService _indexerStatusService;
|
||||
protected readonly IConfigService _configService;
|
||||
protected readonly Logger _logger;
|
||||
|
||||
public abstract string Name { get; }
|
||||
public abstract string BaseUrl { get; }
|
||||
public abstract string[] IndexerUrls { get; }
|
||||
public abstract string Description { get; }
|
||||
public abstract Encoding Encoding { get; }
|
||||
public abstract string Language { get; }
|
||||
@@ -67,10 +67,20 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
public virtual object RequestAction(string action, IDictionary<string, string> query)
|
||||
{
|
||||
if (action == "getUrls")
|
||||
{
|
||||
var links = IndexerUrls;
|
||||
|
||||
return new
|
||||
{
|
||||
options = links.Select(d => new { Value = d, Name = d })
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected TSettings Settings => (TSettings)Definition.Settings;
|
||||
protected TSettings Settings => GetDefaultBaseUrl((TSettings)Definition.Settings);
|
||||
|
||||
public abstract Task<IndexerPageableQueryResult> Fetch(MovieSearchCriteria searchCriteria);
|
||||
public abstract Task<IndexerPageableQueryResult> Fetch(MusicSearchCriteria searchCriteria);
|
||||
@@ -102,6 +112,16 @@ namespace NzbDrone.Core.Indexers
|
||||
return result;
|
||||
}
|
||||
|
||||
protected TSettings GetDefaultBaseUrl(TSettings settings)
|
||||
{
|
||||
if (settings.BaseUrl.IsNullOrWhiteSpace() && IndexerUrls.First().IsNotNullOrWhiteSpace())
|
||||
{
|
||||
settings.BaseUrl = IndexerUrls.First();
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
public ValidationResult Test()
|
||||
{
|
||||
var failures = new List<ValidationFailure>();
|
||||
|
||||
Reference in New Issue
Block a user