mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Auto map known legacy BaseUrls for non-Cardigann
This commit is contained in:
@@ -50,6 +50,7 @@ namespace NzbDrone.Core.Datastore
|
||||
.Ignore(i => i.Language)
|
||||
.Ignore(i => i.Encoding)
|
||||
.Ignore(i => i.IndexerUrls)
|
||||
.Ignore(i => i.LegacyUrls)
|
||||
.Ignore(i => i.Protocol)
|
||||
.Ignore(i => i.Privacy)
|
||||
.Ignore(i => i.SupportsRss)
|
||||
|
@@ -20,6 +20,8 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
|
||||
public override TimeSpan RateLimit => TimeSpan.FromSeconds(5);
|
||||
|
||||
public override string[] IndexerUrls => new string[] { "https://api.broadcasthe.net/" };
|
||||
public override string[] LegacyUrls => new string[] { "http://api.broadcasthe.net/" };
|
||||
|
||||
public override string Description => "BroadcasTheNet (BTN) is an invite-only torrent tracker focused on TV shows";
|
||||
|
||||
public BroadcastheNet(IIndexerHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger)
|
||||
|
@@ -126,6 +126,7 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
Description = definition.Description,
|
||||
Implementation = GetType().Name,
|
||||
IndexerUrls = definition.Links.ToArray(),
|
||||
LegacyUrls = definition.Legacylinks.ToArray(),
|
||||
Settings = new CardigannSettings { DefinitionFile = definition.File },
|
||||
Protocol = DownloadProtocol.Torrent,
|
||||
Privacy = definition.Type switch
|
||||
|
@@ -33,6 +33,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
public override Encoding Encoding => Encoding.UTF8;
|
||||
public override string Language => "en-US";
|
||||
public override string[] LegacyUrls => new string[] { };
|
||||
|
||||
public override bool FollowRedirect => false;
|
||||
public override IndexerCapabilities Capabilities { get; protected set; }
|
||||
|
@@ -14,6 +14,7 @@ namespace NzbDrone.Core.Indexers
|
||||
IndexerCapabilities Capabilities { get; }
|
||||
|
||||
string[] IndexerUrls { get; }
|
||||
string[] LegacyUrls { get; }
|
||||
string Description { get; }
|
||||
Encoding Encoding { get; }
|
||||
string Language { get; }
|
||||
|
@@ -22,6 +22,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
public abstract string Name { get; }
|
||||
public abstract string[] IndexerUrls { get; }
|
||||
public abstract string[] LegacyUrls { get; }
|
||||
public abstract string Description { get; }
|
||||
public abstract Encoding Encoding { get; }
|
||||
public abstract string Language { get; }
|
||||
@@ -147,9 +148,17 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
protected TSettings GetDefaultBaseUrl(TSettings settings)
|
||||
{
|
||||
if (settings.BaseUrl.IsNullOrWhiteSpace() && IndexerUrls.First().IsNotNullOrWhiteSpace())
|
||||
var defaultLink = IndexerUrls.FirstOrDefault();
|
||||
|
||||
if (settings.BaseUrl.IsNullOrWhiteSpace() && defaultLink.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
settings.BaseUrl = IndexerUrls.First();
|
||||
settings.BaseUrl = defaultLink;
|
||||
}
|
||||
|
||||
if (settings.BaseUrl.IsNotNullOrWhiteSpace() && LegacyUrls.Contains(settings.BaseUrl))
|
||||
{
|
||||
_logger.Debug(string.Format("Changing legacy site link from {0} to {1}", settings.BaseUrl, defaultLink));
|
||||
settings.BaseUrl = defaultLink;
|
||||
}
|
||||
|
||||
return settings;
|
||||
|
@@ -11,6 +11,7 @@ namespace NzbDrone.Core.Indexers
|
||||
public class IndexerDefinition : ProviderDefinition
|
||||
{
|
||||
public string[] IndexerUrls { get; set; }
|
||||
public string[] LegacyUrls { get; set; }
|
||||
public string Description { get; set; }
|
||||
public Encoding Encoding { get; set; }
|
||||
public string Language { get; set; }
|
||||
|
@@ -110,6 +110,7 @@ namespace NzbDrone.Core.Indexers
|
||||
}
|
||||
|
||||
definition.IndexerUrls = defFile.Links.ToArray();
|
||||
definition.LegacyUrls = defFile.Legacylinks.ToArray();
|
||||
definition.Description = defFile.Description;
|
||||
definition.Language = defFile.Language;
|
||||
definition.Encoding = Encoding.GetEncoding(defFile.Encoding);
|
||||
@@ -205,6 +206,7 @@ namespace NzbDrone.Core.Indexers
|
||||
if (definition.Implementation != typeof(Cardigann.Cardigann).Name)
|
||||
{
|
||||
definition.IndexerUrls = provider.IndexerUrls;
|
||||
definition.LegacyUrls = provider.LegacyUrls;
|
||||
definition.Privacy = provider.Privacy;
|
||||
definition.Description = provider.Description;
|
||||
definition.Encoding = provider.Encoding;
|
||||
|
@@ -15,6 +15,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
public class IndexerResource : ProviderResource<IndexerResource>
|
||||
{
|
||||
public string[] IndexerUrls { get; set; }
|
||||
public string[] LegacyUrls { get; set; }
|
||||
public string DefinitionName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Language { get; set; }
|
||||
@@ -81,6 +82,7 @@ namespace Prowlarr.Api.V1.Indexers
|
||||
resource.InfoLink = string.Format("https://wiki.servarr.com/prowlarr/supported-indexers#{0}", infoLinkName.ToLower().Replace(' ', '-'));
|
||||
resource.AppProfileId = definition.AppProfileId;
|
||||
resource.IndexerUrls = definition.IndexerUrls;
|
||||
resource.LegacyUrls = definition.LegacyUrls;
|
||||
resource.Description = definition.Description;
|
||||
resource.Language = definition.Language;
|
||||
resource.Encoding = definition.Encoding?.EncodingName ?? null;
|
||||
|
Reference in New Issue
Block a user