New: Alternative Site Links

This commit is contained in:
Qstick
2021-06-13 23:09:42 -04:00
parent 1fb693d066
commit 38c09277d9
107 changed files with 587 additions and 558 deletions
@@ -16,7 +16,6 @@ using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Definitions
@@ -24,7 +23,8 @@ namespace NzbDrone.Core.Indexers.Definitions
public class DigitalCore : TorrentIndexerBase<DigitalCoreSettings>
{
public override string Name => "DigitalCore";
public override string BaseUrl => "https://digitalcore.club/";
public override string[] IndexerUrls => new string[] { "https://digitalcore.club/" };
public override string Description => "DigitalCore is a Private Torrent Tracker for MOVIES / TV / GENERAL";
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
public override IndexerCapabilities Capabilities => SetCapabilities();
@@ -36,12 +36,12 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IIndexerRequestGenerator GetRequestGenerator()
{
return new DigitalCoreRequestGenerator() { Settings = Settings, PageSize = PageSize, Capabilities = Capabilities, BaseUrl = BaseUrl };
return new DigitalCoreRequestGenerator() { Settings = Settings, PageSize = PageSize, Capabilities = Capabilities };
}
public override IParseIndexerResponse GetParser()
{
return new DigitalCoreParser(Settings, Capabilities.Categories, BaseUrl);
return new DigitalCoreParser(Settings, Capabilities.Categories);
}
protected override IDictionary<string, string> GetCookies()
@@ -123,7 +123,6 @@ namespace NzbDrone.Core.Indexers.Definitions
public class DigitalCoreRequestGenerator : IIndexerRequestGenerator
{
public string BaseUrl { get; set; }
public DigitalCoreSettings Settings { get; set; }
public IndexerCapabilities Capabilities { get; set; }
@@ -138,7 +137,7 @@ namespace NzbDrone.Core.Indexers.Definitions
private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categories, string imdbId = null)
{
var searchUrl = string.Format("{0}/api/v1/torrents", BaseUrl.TrimEnd('/'));
var searchUrl = string.Format("{0}/api/v1/torrents", Settings.BaseUrl.TrimEnd('/'));
var parameters = new NameValueCollection();
@@ -226,15 +225,13 @@ namespace NzbDrone.Core.Indexers.Definitions
public class DigitalCoreParser : IParseIndexerResponse
{
private readonly string _baseUrl;
private readonly DigitalCoreSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
public DigitalCoreParser(DigitalCoreSettings settings, IndexerCapabilitiesCategories categories, string baseUrl)
public DigitalCoreParser(DigitalCoreSettings settings, IndexerCapabilitiesCategories categories)
{
_settings = settings;
_categories = categories;
_baseUrl = baseUrl;
}
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
@@ -270,8 +267,8 @@ namespace NzbDrone.Core.Indexers.Definitions
release.Files = row.numfiles;
release.Grabs = row.times_completed;
release.Guid = new Uri(_baseUrl + "torrent/" + row.id.ToString() + "/").ToString();
release.DownloadUrl = _baseUrl + "api/v1/torrents/download/" + row.id.ToString();
release.Guid = new Uri(_settings.BaseUrl + "torrent/" + row.id.ToString() + "/").ToString();
release.DownloadUrl = _settings.BaseUrl + "api/v1/torrents/download/" + row.id.ToString();
if (row.frileech == 1)
{
@@ -317,7 +314,7 @@ namespace NzbDrone.Core.Indexers.Definitions
}
}
public class DigitalCoreSettings : IProviderConfig
public class DigitalCoreSettings : IIndexerSettings
{
private static readonly DigitalCoreSettingsValidator Validator = new DigitalCoreSettingsValidator();
@@ -327,10 +324,13 @@ namespace NzbDrone.Core.Indexers.Definitions
Passphrase = "";
}
[FieldDefinition(1, Label = "UID", HelpText = "Uid from login cookie")]
[FieldDefinition(1, Label = "Base Url", Type = FieldType.Select, SelectOptionsProviderAction = "getUrls", HelpText = "Select which baseurl Prowlarr will use for requests to the site")]
public string BaseUrl { get; set; }
[FieldDefinition(2, Label = "UID", HelpText = "Uid from login cookie")]
public string UId { get; set; }
[FieldDefinition(2, Label = "Passphrase", HelpText = "Pass from login cookie")]
[FieldDefinition(3, Label = "Passphrase", HelpText = "Pass from login cookie")]
public string Passphrase { get; set; }
public NzbDroneValidationResult Validate()