diff --git a/frontend/src/Indexer/Index/Table/IndexerIndexRow.js b/frontend/src/Indexer/Index/Table/IndexerIndexRow.js index eda1175e2..972289214 100644 --- a/frontend/src/Indexer/Index/Table/IndexerIndexRow.js +++ b/frontend/src/Indexer/Index/Table/IndexerIndexRow.js @@ -71,7 +71,7 @@ class IndexerIndexRow extends Component { const { id, name, - baseUrl, + indexerUrls, enable, redirect, tags, @@ -248,7 +248,7 @@ class IndexerIndexRow extends Component { className={styles.externalLink} name={icons.EXTERNAL_LINK} title={'Website'} - to={baseUrl.replace('api.', '')} + to={indexerUrls[0].replace('api.', '')} /> { public override string Name => "Test Indexer"; - public override string BaseUrl => "http://testindexer.com"; + public override string[] IndexerUrls => new string[] { "http://testindexer.com" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Usenet; diff --git a/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs b/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs index 53bf192b8..0ee1716fa 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs @@ -1,12 +1,10 @@ using System; -using System.Collections.Generic; using NzbDrone.Core.Indexers; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Test.IndexerTests { - public class TestIndexerSettings : IProviderConfig + public class TestIndexerSettings : IIndexerSettings { public NzbDroneValidationResult Validate() { diff --git a/src/NzbDrone.Core/Authentication/UserService.cs b/src/NzbDrone.Core/Authentication/UserService.cs index 44ba015c3..73f70aa5b 100644 --- a/src/NzbDrone.Core/Authentication/UserService.cs +++ b/src/NzbDrone.Core/Authentication/UserService.cs @@ -1,11 +1,7 @@ using System; -using System.Linq; -using System.Xml.Linq; using NzbDrone.Common.Disk; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; -using NzbDrone.Core.Lifecycle; -using NzbDrone.Core.Messaging.Events; namespace NzbDrone.Core.Authentication { diff --git a/src/NzbDrone.Core/Datastore/Migration/004_add_update_history.cs b/src/NzbDrone.Core/Datastore/Migration/004_add_update_history.cs index 4e2e3c751..b13837a96 100644 --- a/src/NzbDrone.Core/Datastore/Migration/004_add_update_history.cs +++ b/src/NzbDrone.Core/Datastore/Migration/004_add_update_history.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Data; using FluentMigrator; using NzbDrone.Core.Datastore.Migration.Framework; diff --git a/src/NzbDrone.Core/Datastore/Migration/005_update_notifiarr.cs b/src/NzbDrone.Core/Datastore/Migration/005_update_notifiarr.cs index 1a0fa60ad..5f7606ba2 100644 --- a/src/NzbDrone.Core/Datastore/Migration/005_update_notifiarr.cs +++ b/src/NzbDrone.Core/Datastore/Migration/005_update_notifiarr.cs @@ -1,5 +1,4 @@ using FluentMigrator; -using Newtonsoft.Json.Linq; using NzbDrone.Core.Datastore.Migration.Framework; namespace NzbDrone.Core.Datastore.Migration diff --git a/src/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs index a4e9ebe18..1ab5e9994 100644 --- a/src/NzbDrone.Core/Datastore/TableMapping.cs +++ b/src/NzbDrone.Core/Datastore/TableMapping.cs @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Datastore .Ignore(i => i.Description) .Ignore(i => i.Language) .Ignore(i => i.Encoding) - .Ignore(i => i.BaseUrl) + .Ignore(i => i.IndexerUrls) .Ignore(i => i.Protocol) .Ignore(i => i.Privacy) .Ignore(i => i.SupportsRss) diff --git a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs index ee19dd95c..1d9a4963d 100644 --- a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs +++ b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs @@ -6,7 +6,6 @@ using FluentValidation.Results; using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; -using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Indexers; using NzbDrone.Core.Parser; diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index ad88d89f9..9a5787e0a 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -1,5 +1,4 @@ using System; -using System.Net; using System.Text; using System.Threading.Tasks; using MonoTorrent; diff --git a/src/NzbDrone.Core/Exceptions/ReleaseDownloadException.cs b/src/NzbDrone.Core/Exceptions/ReleaseDownloadException.cs index 037fe09c1..be1d51360 100644 --- a/src/NzbDrone.Core/Exceptions/ReleaseDownloadException.cs +++ b/src/NzbDrone.Core/Exceptions/ReleaseDownloadException.cs @@ -1,6 +1,5 @@ using System; using NzbDrone.Common.Exceptions; -using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Exceptions { diff --git a/src/NzbDrone.Core/Exceptions/ReleaseUnavailableException.cs b/src/NzbDrone.Core/Exceptions/ReleaseUnavailableException.cs index 2af8c9a40..86fe97845 100644 --- a/src/NzbDrone.Core/Exceptions/ReleaseUnavailableException.cs +++ b/src/NzbDrone.Core/Exceptions/ReleaseUnavailableException.cs @@ -1,5 +1,4 @@ using System; -using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Exceptions { diff --git a/src/NzbDrone.Core/Indexers/Definitions/Aither.cs b/src/NzbDrone.Core/Indexers/Definitions/Aither.cs index f8fd8f589..ea6d3a5b8 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Aither.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Aither.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class Aither : Unit3dBase { public override string Name => "Aither"; - public override string BaseUrl => "https://aither.cc/"; + public override string[] IndexerUrls => new string[] { "https://aither.cc/" }; public override string Description => "Aither is a Private Torrent Tracker for HD MOVIES / TV"; public override string Language => "en-us"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; diff --git a/src/NzbDrone.Core/Indexers/Definitions/AlphaRatio.cs b/src/NzbDrone.Core/Indexers/Definitions/AlphaRatio.cs index 3422e8a0a..9bd9f36b3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AlphaRatio.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AlphaRatio.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class AlphaRatio : Gazelle.Gazelle { public override string Name => "AlphaRatio"; - public override string BaseUrl => "https://alpharatio.cc/"; + public override string[] IndexerUrls => new string[] { "https://alpharatio.cc/" }; public override string Description => "AlphaRatio(AR) is a Private Torrent Tracker for 0DAY / GENERAL"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; @@ -25,8 +25,7 @@ namespace NzbDrone.Core.Indexers.Definitions Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs b/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs index 0fc83997e..f0b5d0332 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs @@ -18,7 +18,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 @@ -26,7 +25,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class AnimeBytes : TorrentIndexerBase { public override string Name => "AnimeBytes"; - public override string BaseUrl => "https://animebytes.tv/"; + public override string[] IndexerUrls => new string[] { "https://animebytes.tv/" }; public override string Description => "Powered by Tentacles"; public override string Language => "en-us"; public override Encoding Encoding => Encoding.UTF8; @@ -41,12 +40,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new AnimeBytesRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new AnimeBytesRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new AnimeBytesParser(Settings, Capabilities.Categories, BaseUrl); + return new AnimeBytesParser(Settings, Capabilities.Categories); } protected override bool CheckIfLoginNeeded(HttpResponse httpResponse) @@ -101,7 +100,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public AnimeBytesSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public AnimeBytesRequestGenerator() { @@ -109,7 +107,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string searchType, string term, int[] categories) { - var searchUrl = string.Format("{0}/scrape.php", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/scrape.php", Settings.BaseUrl.TrimEnd('/')); var queryCollection = new NameValueCollection { @@ -189,13 +187,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly AnimeBytesSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public AnimeBytesParser(AnimeBytesSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public AnimeBytesParser(AnimeBytesSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -323,7 +319,7 @@ namespace NzbDrone.Core.Indexers.Definitions var uploadTimeString = (string)torrent["UploadTime"]; var uploadTime = DateTime.ParseExact(uploadTimeString, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); var publishDate = DateTime.SpecifyKind(uploadTime, DateTimeKind.Utc).ToLocalTime(); - var details = new Uri(_baseUrl + "torrent/" + torrentId + "/group"); + var details = new Uri(_settings.BaseUrl + "torrent/" + torrentId + "/group"); var size = (long)torrent["Size"]; var snatched = (int)torrent["Snatched"]; var seeders = (int)torrent["Seeders"]; @@ -484,7 +480,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class AnimeBytesSettings : IProviderConfig + public class AnimeBytesSettings : IIndexerSettings { private static readonly AnimeBytesSettingsValidator Validator = new AnimeBytesSettingsValidator(); @@ -494,10 +490,13 @@ namespace NzbDrone.Core.Indexers.Definitions Username = ""; } - [FieldDefinition(1, Label = "Passkey", Privacy = PrivacyLevel.Password, Type = FieldType.Password, HelpText = "Site Passkey")] + [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 = "Passkey", Privacy = PrivacyLevel.Password, Type = FieldType.Password, HelpText = "Site Passkey")] public string Passkey { get; set; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [FieldDefinition(3, Label = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs index cfa060e89..332b62f22 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AnimeTorrents.cs @@ -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 @@ -25,8 +24,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "AnimeTorrents"; - public override string BaseUrl => "https://animetorrents.me/"; - private string LoginUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "https://animetorrents.me/" }; + public override string Description => "Definitive source for anime and manga"; + private string LoginUrl => Settings.BaseUrl + "login.php"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -38,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new AnimeTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new AnimeTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new AnimeTorrentsParser(Settings, Capabilities.Categories, BaseUrl); + return new AnimeTorrentsParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -135,7 +135,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public AnimeTorrentsSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public AnimeTorrentsRequestGenerator() { @@ -148,8 +147,8 @@ namespace NzbDrone.Core.Indexers.Definitions // replace any space, special char, etc. with % (wildcard) var replaceRegex = new Regex("[^a-zA-Z0-9]+"); searchString = replaceRegex.Replace(searchString, "%"); - var searchUrl = BaseUrl + "ajax/torrents_data.php"; - var searchUrlReferer = BaseUrl + "torrents.php?cat=0&searchin=filename&search="; + var searchUrl = Settings.BaseUrl + "ajax/torrents_data.php"; + var searchUrlReferer = Settings.BaseUrl + "torrents.php?cat=0&searchin=filename&search="; var trackerCats = Capabilities.Categories.MapTorznabCapsToTrackers(categories) ?? new List(); @@ -229,13 +228,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly AnimeTorrentsSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public AnimeTorrentsParser(AnimeTorrentsSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public AnimeTorrentsParser(AnimeTorrentsSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -340,7 +337,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class AnimeTorrentsSettings : IProviderConfig + public class AnimeTorrentsSettings : IIndexerSettings { private static readonly AnimeTorrentsSettingsValidator Validator = new AnimeTorrentsSettingsValidator(); @@ -350,10 +347,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/AnimeWorld.cs b/src/NzbDrone.Core/Indexers/Definitions/AnimeWorld.cs index 49e3a8805..c6eb1a217 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AnimeWorld.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AnimeWorld.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class AnimeWorld : Unit3dBase { public override string Name => "AnimeWorld"; - public override string BaseUrl => "https://animeworld.cx/"; + public override string[] IndexerUrls => new string[] { "https://animeworld.cx/" }; public override string Description => "AnimeWorld (AW) is a GERMAN Private site for ANIME / MANGA / HENTAI"; public override string Language => "de-de"; diff --git a/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs b/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs index 9364280d9..835055ea9 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Anthelion.cs @@ -24,8 +24,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class Anthelion : TorrentIndexerBase { public override string Name => "Anthelion"; - public override string BaseUrl => "https://anthelion.me/"; - private string LoginUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "https://anthelion.me/" }; + private string LoginUrl => Settings.BaseUrl + "login.php"; public override string Description => "A movies tracker"; public override string Language => "en-us"; public override Encoding Encoding => Encoding.UTF8; @@ -40,12 +40,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new AnthelionRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new AnthelionRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new AnthelionParser(Settings, Capabilities.Categories, BaseUrl); + return new AnthelionParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -214,13 +214,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly AnthelionSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public AnthelionParser(AnthelionSettings settings, IndexerCapabilitiesCategories categories, string baseurl) + public AnthelionParser(AnthelionSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseurl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -237,9 +235,9 @@ namespace NzbDrone.Core.Indexers.Definitions var tags = row.QuerySelector("div.torrent_info").FirstChild.TextContent.Replace(" / ", " ").Trim(); var title = $"{qDetailsLink.TextContent} {year} {tags}"; var description = row.QuerySelector("div.tags").TextContent.Trim(); - var details = _baseUrl + qDetailsLink.GetAttribute("href"); + var details = _settings.BaseUrl + qDetailsLink.GetAttribute("href"); var torrentId = qDetailsLink.GetAttribute("href").Split('=').Last(); - var link = _baseUrl + "torrents.php?action=download&id=" + torrentId; + var link = _settings.BaseUrl + "torrents.php?action=download&id=" + torrentId; var posterStr = qDetailsLink.GetAttribute("data-cover"); var poster = !string.IsNullOrWhiteSpace(posterStr) ? new Uri(qDetailsLink.GetAttribute("data-cover")) : null; @@ -308,7 +306,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class AnthelionSettings : IProviderConfig + public class AnthelionSettings : IIndexerSettings { private static readonly AnthelionSettingsValidator Validator = new AnthelionSettingsValidator(); @@ -318,10 +316,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(1, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs b/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs index 90794c011..ec55fd785 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AvistaZ.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class AvistaZ : AvistazBase { public override string Name => "AvistaZ"; - public override string BaseUrl => "https://avistaz.to/"; + public override string[] IndexerUrls => new string[] { "https://avistaz.to/" }; + public override string Description => "Aka AsiaTorrents"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public AvistaZ(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) @@ -25,8 +26,7 @@ namespace NzbDrone.Core.Indexers.Definitions Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazBase.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazBase.cs index 36aa474b7..3e39259c8 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazBase.cs @@ -12,8 +12,8 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public abstract class AvistazBase : TorrentIndexerBase { public override DownloadProtocol Protocol => DownloadProtocol.Torrent; - public override string BaseUrl => ""; - protected virtual string LoginUrl => BaseUrl + "api/v1/jackett/auth"; + public override string[] IndexerUrls => new string[] { "" }; + protected virtual string LoginUrl => Settings.BaseUrl + "api/v1/jackett/auth"; public override bool SupportsRss => true; public override bool SupportsSearch => true; public override int PageSize => 50; @@ -38,8 +38,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs index 0d1cf9ba6..81f9b3c42 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazRequestGenerator.cs @@ -12,14 +12,13 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public class AvistazRequestGenerator : IIndexerRequestGenerator { public AvistazSettings Settings { get; set; } - public string BaseUrl { get; set; } public IDictionary AuthCookieCache { get; set; } public IHttpClient HttpClient { get; set; } public IndexerCapabilities Capabilities { get; set; } public Logger Logger { get; set; } - protected virtual string SearchUrl => BaseUrl + "api/v1/jackett/torrents"; + protected virtual string SearchUrl => Settings.BaseUrl + "api/v1/jackett/torrents"; protected virtual bool ImdbInTags => false; public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazSettings.cs index ba4dc1d7f..f64c6bd3f 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Avistaz/AvistazSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Definitions.Avistaz @@ -15,7 +14,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz } } - public class AvistazSettings : IProviderConfig + public class AvistazSettings : IIndexerSettings { private static readonly AvistazSettingsValidator Validator = new AvistazSettingsValidator(); @@ -26,13 +25,16 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz public string Token { get; set; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } - [FieldDefinition(3, Label = "PID", HelpText = "PID from My Account or My Profile page")] + [FieldDefinition(4, Label = "PID", HelpText = "PID from My Account or My Profile page")] public string Pid { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs index 15cbb5e2c..a5a097e40 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs @@ -16,7 +16,6 @@ using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Parser.Model; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Definitions @@ -25,8 +24,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "BakaBT"; - public override string BaseUrl => "https://bakabt.me/"; - private string LoginUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "https://bakabt.me/" }; + public override string Description => "Anime Comunity"; + private string LoginUrl => Settings.BaseUrl + "login.php"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -38,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new BakaBTRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new BakaBTRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new BakaBTParser(Settings, Capabilities.Categories, BaseUrl); + return new BakaBTParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -138,7 +138,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public BakaBTSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public BakaBTRequestGenerator() { @@ -147,7 +146,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories) { var searchString = term; - var searchUrl = BaseUrl + "browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&reorder=1&q="; + var searchUrl = Settings.BaseUrl + "browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&reorder=1&q="; var match = Regex.Match(term, @".*(?=\s(?:[Ee]\d+|\d+)$)"); if (match.Success) @@ -213,14 +212,12 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly BakaBTSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; private readonly List _defaultCategories = new List { NewznabStandardCategory.TVAnime }; - public BakaBTParser(BakaBTSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public BakaBTParser(BakaBTSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -300,10 +297,10 @@ namespace NzbDrone.Core.Indexers.Definitions release.Categories = currentCategories; //release.Description = row.QuerySelector("span.tags")?.TextContent; - release.Guid = _baseUrl + qTitleLink.GetAttribute("href"); + release.Guid = _settings.BaseUrl + qTitleLink.GetAttribute("href"); release.InfoUrl = release.Guid; - release.DownloadUrl = _baseUrl + row.QuerySelector(".peers a").GetAttribute("href"); + release.DownloadUrl = _settings.BaseUrl + row.QuerySelector(".peers a").GetAttribute("href"); var grabs = row.QuerySelectorAll(".peers")[0].FirstChild.NodeValue.TrimEnd().TrimEnd('/').TrimEnd(); grabs = grabs.Replace("k", "000"); @@ -392,7 +389,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class BakaBTSettings : IProviderConfig + public class BakaBTSettings : IIndexerSettings { private static readonly BakaBTSettingsValidator Validator = new BakaBTSettingsValidator(); @@ -402,16 +399,19 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } - [FieldDefinition(3, Label = "Add Romaji Title", Type = FieldType.Checkbox, HelpText = "Add releases for Romaji Title")] + [FieldDefinition(4, Label = "Add Romaji Title", Type = FieldType.Checkbox, HelpText = "Add releases for Romaji Title")] public bool AddRomajiTitle { get; set; } - [FieldDefinition(4, Label = "Append Season", Type = FieldType.Checkbox, HelpText = "Append Season for Sonarr Compatibility")] + [FieldDefinition(5, Label = "Append Season", Type = FieldType.Checkbox, HelpText = "Append Season for Sonarr Compatibility")] public bool AppendSeason { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs b/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs index e98bbcfdd..145744f7b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BeyondHD.cs @@ -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 @@ -25,7 +24,8 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "BeyondHD"; - public override string BaseUrl => "https://beyond-hd.me/"; + public override string[] IndexerUrls => new string[] { "https://beyond-hd.me/" }; + public override string Description => "Without BeyondHD, your HDTV is just a TV"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -37,12 +37,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new BeyondHDRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new BeyondHDRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new BeyondHDParser(Settings, Capabilities.Categories, BaseUrl); + return new BeyondHDParser(Settings, Capabilities.Categories); } private IndexerCapabilities SetCapabilities() @@ -70,7 +70,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public BeyondHDSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public BeyondHDRequestGenerator() { @@ -106,7 +105,7 @@ namespace NzbDrone.Core.Indexers.Definitions body.Add("categories", string.Join(",", cats)); } - var searchUrl = BaseUrl + "api/torrents/" + Settings.ApiKey; + var searchUrl = Settings.BaseUrl + "api/torrents/" + Settings.ApiKey; var request = new HttpRequest(searchUrl, HttpAccept.Json); @@ -172,13 +171,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly BeyondHDSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public BeyondHDParser(BeyondHDSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public BeyondHDParser(BeyondHDSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -242,7 +239,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class BeyondHDSettings : IProviderConfig + public class BeyondHDSettings : IIndexerSettings { private static readonly BeyondHDSettingsValidator Validator = new BeyondHDSettingsValidator(); @@ -250,10 +247,13 @@ namespace NzbDrone.Core.Indexers.Definitions { } - [FieldDefinition(1, Label = "API Key", HelpText = "API Key from Site", Privacy = PrivacyLevel.ApiKey)] + [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 = "API Key", HelpText = "API Key from Site", Privacy = PrivacyLevel.ApiKey)] public string ApiKey { get; set; } - [FieldDefinition(2, Label = "RSS Key", HelpText = "RSS Key from Site", Privacy = PrivacyLevel.ApiKey)] + [FieldDefinition(3, Label = "RSS Key", HelpText = "RSS Key from Site", Privacy = PrivacyLevel.ApiKey)] public string RssKey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Blutopia.cs b/src/NzbDrone.Core/Indexers/Definitions/Blutopia.cs index 11e67d878..72152ed02 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Blutopia.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Blutopia.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class Blutopia : Unit3dBase { public override string Name => "Blutopia"; - public override string BaseUrl => "https://blutopia.xyz/"; + public override string[] IndexerUrls => new string[] { "https://blutopia.xyz/" }; + public override string Description => "Blutopia (BLU) is a Private Torrent Tracker for HD MOVIES / TV"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public Blutopia(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs index 64bf2b287..7adfeec02 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNet.cs @@ -17,7 +17,8 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet public override int PageSize => 100; public override IndexerCapabilities Capabilities => SetCapabilities(); - public override string BaseUrl => "http://api.broadcasthe.net/"; + public override string[] IndexerUrls => new string[] { "http://api.broadcasthe.net/" }; + public override string Description => "BroadcasTheNet (BTN) is an invite-only torrent tracker focused on TV shows"; public BroadcastheNet(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger) @@ -26,7 +27,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet public override IIndexerRequestGenerator GetRequestGenerator() { - var requestGenerator = new BroadcastheNetRequestGenerator() { Settings = Settings, PageSize = PageSize, BaseUrl = BaseUrl, Capabilities = Capabilities }; + var requestGenerator = new BroadcastheNetRequestGenerator() { Settings = Settings, PageSize = PageSize, Capabilities = Capabilities }; var releaseInfo = _indexerStatusService.GetLastRssSyncReleaseInfo(Definition.Id); if (releaseInfo != null) diff --git a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs index 6580f9e6e..89c610010 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetRequestGenerator.cs @@ -16,7 +16,6 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } - public string BaseUrl { get; set; } public BroadcastheNetRequestGenerator() { @@ -26,7 +25,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet private IEnumerable GetPagedRequests(BroadcastheNetTorrentQuery parameters, int results, int offset) { - var builder = new JsonRpcRequestBuilder(BaseUrl) + var builder = new JsonRpcRequestBuilder(Settings.BaseUrl) .Call("getTorrents", Settings.ApiKey, parameters, results, offset); builder.SuppressHttpError = true; diff --git a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetSettings.cs index 24e090f1f..8d0d8a999 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BroadcastheNet/BroadcastheNetSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.BroadcastheNet @@ -13,7 +12,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet } } - public class BroadcastheNetSettings : IProviderConfig + public class BroadcastheNetSettings : IIndexerSettings { private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator(); @@ -21,7 +20,10 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet { } - [FieldDefinition(1, Label = "API Key", Privacy = PrivacyLevel.ApiKey)] + [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 = "API Key", Privacy = PrivacyLevel.ApiKey)] public string ApiKey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/BrokenStones.cs b/src/NzbDrone.Core/Indexers/Definitions/BrokenStones.cs index 70a4fc4f9..1be45bf2c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BrokenStones.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BrokenStones.cs @@ -8,7 +8,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class BrokenStones : Gazelle.Gazelle { public override string Name => "BrokenStones"; - public override string BaseUrl => "https://brokenstones.club/"; + public override string[] IndexerUrls => new string[] { "https://brokenstones.club/" }; + public override string Description => "Broken Stones is a Private site for MacOS and iOS APPS / GAMES"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public BrokenStones(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/CGPeers.cs b/src/NzbDrone.Core/Indexers/Definitions/CGPeers.cs index 952b0c678..61f7baaed 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/CGPeers.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/CGPeers.cs @@ -8,7 +8,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class CGPeers : Gazelle.Gazelle { public override string Name => "CGPeers"; - public override string BaseUrl => "https://cgpeers.to/"; + public override string[] IndexerUrls => new string[] { "https://cgpeers.to/" }; + public override string Description => "CGPeers is a Private Torrent Tracker for GRAPHICS SOFTWARE / TUTORIALS / ETC"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public CGPeers(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs index 974956555..51ebc6638 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; @@ -22,7 +23,8 @@ namespace NzbDrone.Core.Indexers.Cardigann private readonly ICached _generatorCache; public override string Name => "Cardigann"; - public override string BaseUrl => ""; + public override string[] IndexerUrls => new string[] { "" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; @@ -120,6 +122,7 @@ namespace NzbDrone.Core.Indexers.Cardigann Language = definition.Language, Description = definition.Description, Implementation = GetType().Name, + IndexerUrls = definition.Links.ToArray(), Settings = new CardigannSettings { DefinitionFile = definition.File }, Protocol = DownloadProtocol.Torrent, Privacy = definition.Type == "private" ? IndexerPrivacy.Private : IndexerPrivacy.Public, @@ -236,6 +239,16 @@ namespace NzbDrone.Core.Indexers.Cardigann }; } + if (action == "getUrls") + { + var devices = ((IndexerDefinition)Definition).IndexerUrls; + + return new + { + options = devices.Select(d => new { Value = d, Name = d }) + }; + } + return null; } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs index cc9b1af0d..fe4467ea3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannBase.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.Indexers.Cardigann protected readonly Encoding _encoding; protected readonly IConfigService _configService; - protected string SiteLink { get; private set; } + protected virtual string SiteLink { get; private set; } protected readonly List _categoryMapping = new List(); protected readonly List _defaultCategories = new List(); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs index 0735ffd41..4c0494d51 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannParser.cs @@ -18,6 +18,8 @@ namespace NzbDrone.Core.Indexers.Cardigann { public Action, DateTime?> CookiesUpdater { get; set; } + protected override string SiteLink => Settings?.BaseUrl ?? _definition.Links.First(); + public CardigannParser(IConfigService configService, CardigannDefinition definition, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs index 3bf090bfd..d8c042850 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannRequestGenerator.cs @@ -22,6 +22,7 @@ namespace NzbDrone.Core.Indexers.Cardigann public IDictionary Cookies { get; set; } protected HttpResponse landingResult; protected IHtmlDocument landingResultDocument; + protected override string SiteLink => Settings?.BaseUrl ?? _definition.Links.First(); public CardigannRequestGenerator(IConfigService configService, CardigannDefinition definition, diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannSettings.cs index fea665aae..fe0bc7097 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/CardigannSettings.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Cardigann @@ -13,7 +12,7 @@ namespace NzbDrone.Core.Indexers.Cardigann } } - public class CardigannSettings : IProviderConfig + public class CardigannSettings : IIndexerSettings { private static readonly CardigannSettingsValidator Validator = new CardigannSettingsValidator(); @@ -25,6 +24,9 @@ namespace NzbDrone.Core.Indexers.Cardigann [FieldDefinition(0, Hidden = HiddenType.Hidden)] public string DefinitionFile { get; set; } + [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; } + public Dictionary ExtraFieldData { get; set; } // Field 8 is used by TorznabSettings MinimumSeeders diff --git a/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs b/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs index 41e7e7db9..fab805b97 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/CinemaZ.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class CinemaZ : AvistazBase { public override string Name => "CinemaZ"; - public override string BaseUrl => "https://cinemaz.to/"; + public override string[] IndexerUrls => new string[] { "https://cinemaz.to/" }; + public override string Description => "Part of the Avistaz network."; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public CinemaZ(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) @@ -25,8 +26,7 @@ namespace NzbDrone.Core.Indexers.Definitions Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/DigitalCore.cs b/src/NzbDrone.Core/Indexers/Definitions/DigitalCore.cs index ae47873aa..a149a499d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/DigitalCore.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/DigitalCore.cs @@ -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 { 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 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 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 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() diff --git a/src/NzbDrone.Core/Indexers/Definitions/ExoticaZ.cs b/src/NzbDrone.Core/Indexers/Definitions/ExoticaZ.cs index 57fdb2961..2ace73a1d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ExoticaZ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ExoticaZ.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class ExoticaZ : AvistazBase { public override string Name => "ExoticaZ"; - public override string BaseUrl => "https://exoticaz.to/"; + public override string[] IndexerUrls => new string[] { "https://exoticaz.to/" }; + public override string Description => "ExoticaZ (YourExotic) is a Private Torrent Tracker for 3X"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public ExoticaZ(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) @@ -26,7 +27,6 @@ namespace NzbDrone.Core.Indexers.Definitions HttpClient = _httpClient, Logger = _logger, Capabilities = Capabilities, - BaseUrl = BaseUrl }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs index cb22594b7..3be337450 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileList.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Indexers.FileList public class FileList : TorrentIndexerBase { public override string Name => "FileList.io"; - public override string BaseUrl => "https://filelist.io"; + public override string[] IndexerUrls => new string[] { "https://filelist.io" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override bool SupportsRss => true; @@ -24,12 +25,12 @@ namespace NzbDrone.Core.Indexers.FileList public override IIndexerRequestGenerator GetRequestGenerator() { - return new FileListRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl, Capabilities = Capabilities }; + return new FileListRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new FileListParser(Settings, BaseUrl, Capabilities.Categories); + return new FileListParser(Settings, Capabilities.Categories); } private IndexerCapabilities SetCapabilities() diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs index 2367cc01f..2a4176bd2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListParser.cs @@ -10,14 +10,12 @@ namespace NzbDrone.Core.Indexers.FileList { public class FileListParser : IParseIndexerResponse { - private readonly string _baseUrl; private readonly FileListSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - public FileListParser(FileListSettings settings, string baseUrl, IndexerCapabilitiesCategories categories) + public FileListParser(FileListSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; - _baseUrl = baseUrl; _categories = categories; } @@ -78,7 +76,7 @@ namespace NzbDrone.Core.Indexers.FileList private string GetDownloadUrl(string torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/download.php") .AddQueryParam("id", torrentId) .AddQueryParam("passkey", _settings.Passkey); @@ -88,7 +86,7 @@ namespace NzbDrone.Core.Indexers.FileList private string GetInfoUrl(string torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/details.php") .AddQueryParam("id", torrentId); diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs index 005b2e412..226903005 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListRequestGenerator.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.IndexerSearch.Definitions; @@ -9,7 +8,6 @@ namespace NzbDrone.Core.Indexers.FileList { public class FileListRequestGenerator : IIndexerRequestGenerator { - public string BaseUrl { get; set; } public FileListSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } public Func> GetCookies { get; set; } @@ -109,7 +107,7 @@ namespace NzbDrone.Core.Indexers.FileList { var categoriesQuery = string.Join(",", Capabilities.Categories.MapTorznabCapsToTrackers(categories)); - var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters); + var baseUrl = string.Format("{0}/api.php?action={1}&category={2}&username={3}&passkey={4}{5}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, Settings.Username.Trim(), Settings.Passkey.Trim(), parameters); yield return new IndexerRequest(baseUrl, HttpAccept.Json); } diff --git a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs index c7a9c87fb..3867634ab 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/FileList/FileListSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.FileList @@ -14,18 +13,22 @@ namespace NzbDrone.Core.Indexers.FileList } } - public class FileListSettings : IProviderConfig + public class FileListSettings : IIndexerSettings { private static readonly FileListSettingsValidator Validator = new FileListSettingsValidator(); public FileListSettings() { + BaseUrl = "https://filelist.io"; } - [FieldDefinition(0, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(1, Label = "Passkey", Privacy = PrivacyLevel.ApiKey)] + [FieldDefinition(3, Label = "Passkey", Privacy = PrivacyLevel.ApiKey)] public string Passkey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/Gazelle.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/Gazelle.cs index eb11cc192..03e7281af 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/Gazelle.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/Gazelle.cs @@ -10,8 +10,8 @@ namespace NzbDrone.Core.Indexers.Gazelle public abstract class Gazelle : TorrentIndexerBase { public override DownloadProtocol Protocol => DownloadProtocol.Torrent; - public override string BaseUrl => ""; - protected virtual string LoginUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "" }; + protected virtual string LoginUrl => Settings.BaseUrl + "login.php"; public override bool SupportsRss => true; public override bool SupportsSearch => true; public override int PageSize => 50; @@ -33,14 +33,13 @@ namespace NzbDrone.Core.Indexers.Gazelle Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new GazelleParser(Settings, Capabilities, BaseUrl); + return new GazelleParser(Settings, Capabilities); } protected virtual IndexerCapabilities SetCapabilities() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs index 12af956e0..f04f04bca 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs @@ -13,13 +13,11 @@ namespace NzbDrone.Core.Indexers.Gazelle { protected readonly GazelleSettings _settings; protected readonly IndexerCapabilities _capabilities; - protected readonly string _baseUrl; - public GazelleParser(GazelleSettings settings, IndexerCapabilities capabilities, string baseUrl) + public GazelleParser(GazelleSettings settings, IndexerCapabilities capabilities) { _settings = settings; _capabilities = capabilities; - _baseUrl = baseUrl; } public Action, DateTime?> CookiesUpdater { get; set; } @@ -140,7 +138,7 @@ namespace NzbDrone.Core.Indexers.Gazelle protected virtual string GetDownloadUrl(int torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") .AddQueryParam("useToken", _settings.UseFreeleechToken ? "1" : "0") @@ -151,7 +149,7 @@ namespace NzbDrone.Core.Indexers.Gazelle private string GetInfoUrl(string groupId, int torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("id", groupId) .AddQueryParam("torrentid", torrentId); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs index 0a156a1f5..a7aaeae6f 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleRequestGenerator.cs @@ -9,14 +9,13 @@ namespace NzbDrone.Core.Indexers.Gazelle public class GazelleRequestGenerator : IIndexerRequestGenerator { public GazelleSettings Settings { get; set; } - public string BaseUrl { get; set; } public IDictionary AuthCookieCache { get; set; } public IHttpClient HttpClient { get; set; } public IndexerCapabilities Capabilities { get; set; } public Logger Logger { get; set; } - protected virtual string APIUrl => BaseUrl + "ajax.php"; + protected virtual string APIUrl => Settings.BaseUrl + "ajax.php"; protected virtual bool ImdbInTags => false; public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleSettings.cs index 91e9ba028..658bb140e 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Gazelle @@ -14,7 +13,7 @@ namespace NzbDrone.Core.Indexers.Gazelle } } - public class GazelleSettings : IProviderConfig + public class GazelleSettings : IIndexerSettings { private static readonly GazelleSettingsValidator Validator = new GazelleSettingsValidator(); @@ -25,13 +24,16 @@ namespace NzbDrone.Core.Indexers.Gazelle public string AuthKey; public string PassKey; - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } - [FieldDefinition(3, Type = FieldType.Checkbox, Label = "Use Freeleech Token", HelpText = "Use Freeleech Token")] + [FieldDefinition(4, Type = FieldType.Checkbox, Label = "Use Freeleech Token", HelpText = "Use Freeleech Token")] public bool UseFreeleechToken { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs b/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs index 44fc0d7a8..4144ee6f4 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; +using System.Linq; using System.Text; using AngleSharp.Html.Parser; using FluentValidation; @@ -21,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class GazelleGames : TorrentIndexerBase { public override string Name => "GazelleGames"; - public override string BaseUrl => "https://gazellegames.net/"; + public override string[] IndexerUrls => new string[] { "https://gazellegames.net/" }; public override string Description => "A gaming tracker."; public override string Language => "en-us"; public override Encoding Encoding => Encoding.UTF8; @@ -36,12 +37,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new GazelleGamesRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new GazelleGamesRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new GazelleGamesParser(Settings, Capabilities.Categories, BaseUrl); + return new GazelleGamesParser(Settings, Capabilities.Categories); } protected override IDictionary GetCookies() @@ -188,7 +189,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public GazelleGamesSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public GazelleGamesRequestGenerator() { @@ -196,7 +196,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories) { - var searchUrl = string.Format("{0}/torrents.php", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/torrents.php", Settings.BaseUrl.TrimEnd('/')); var searchString = term; @@ -278,13 +278,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly GazelleGamesSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public GazelleGamesParser(GazelleGamesSettings settings, IndexerCapabilitiesCategories categories, string baseurl) + public GazelleGamesParser(GazelleGamesSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseurl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -355,12 +353,12 @@ namespace NzbDrone.Core.Indexers.Definitions var qFreeLeech = row.QuerySelector("strong.freeleech_label"); var qNeutralLeech = row.QuerySelector("strong.neutralleech_label"); var time = qTime.GetAttribute("title"); - var link = _baseUrl + qDLLink.GetAttribute("href"); + var link = _settings.BaseUrl + qDLLink.GetAttribute("href"); var seeders = ParseUtil.CoerceInt(qSeeders.TextContent); var publishDate = DateTime.SpecifyKind( DateTime.ParseExact(time, "MMM dd yyyy, HH:mm", CultureInfo.InvariantCulture), DateTimeKind.Unspecified).ToLocalTime(); - var details = _baseUrl + qDetailsLink.GetAttribute("href"); + var details = _settings.BaseUrl + qDetailsLink.GetAttribute("href"); var grabs = ParseUtil.CoerceInt(qGrabs.TextContent); var leechers = ParseUtil.CoerceInt(qLeechers.TextContent); var size = ReleaseInfo.GetBytes(sizeString); @@ -402,7 +400,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class GazelleGamesSettings : IProviderConfig + public class GazelleGamesSettings : IIndexerSettings { private static readonly GazelleGamesSettingsValidator Validator = new GazelleGamesSettingsValidator(); @@ -412,10 +410,13 @@ namespace NzbDrone.Core.Indexers.Definitions SearchGroupNames = false; } - [FieldDefinition(1, Label = "Cookie", HelpText = "Login cookie from website")] + [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 = "Cookie", HelpText = "Login cookie from website")] public string Cookie { get; set; } - [FieldDefinition(2, Label = "Search Group Names", Type = FieldType.Checkbox, HelpText = "Search Group Names Only")] + [FieldDefinition(3, Label = "Search Group Names", Type = FieldType.Checkbox, HelpText = "Search Group Names Only")] public bool SearchGroupNames { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBits.cs b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBits.cs index af141d2e3..569465925 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBits.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBits.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Indexers.HDBits public class HDBits : TorrentIndexerBase { public override string Name => "HDBits"; - public override string BaseUrl => "https://hdbits.org"; + public override string[] IndexerUrls => new string[] { "https://hdbits.org" }; + public override string Description => "Best HD Tracker"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -24,12 +25,12 @@ namespace NzbDrone.Core.Indexers.HDBits public override IIndexerRequestGenerator GetRequestGenerator() { - return new HDBitsRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl, Capabilities = Capabilities }; + return new HDBitsRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new HDBitsParser(Settings, BaseUrl); + return new HDBitsParser(Settings); } private IndexerCapabilities SetCapabilities() diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsParser.cs b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsParser.cs index dbf70def2..3c1d43371 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsParser.cs @@ -11,13 +11,11 @@ namespace NzbDrone.Core.Indexers.HDBits { public class HDBitsParser : IParseIndexerResponse { - private readonly string _baseUrl; private readonly HDBitsSettings _settings; - public HDBitsParser(HDBitsSettings settings, string baseUrl) + public HDBitsParser(HDBitsSettings settings) { _settings = settings; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -91,7 +89,7 @@ namespace NzbDrone.Core.Indexers.HDBits private string GetDownloadUrl(string torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/download.php") .AddQueryParam("id", torrentId) .AddQueryParam("passkey", _settings.ApiKey); @@ -101,7 +99,7 @@ namespace NzbDrone.Core.Indexers.HDBits private string GetInfoUrl(string torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/details.php") .AddQueryParam("id", torrentId); diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs index f0f178975..dc035f32e 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsRequestGenerator.cs @@ -12,7 +12,6 @@ namespace NzbDrone.Core.Indexers.HDBits { public IndexerCapabilities Capabilities { get; set; } public HDBitsSettings Settings { get; set; } - public string BaseUrl { get; set; } public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) { @@ -50,7 +49,7 @@ namespace NzbDrone.Core.Indexers.HDBits private IEnumerable GetRequest(TorrentQuery query) { - var request = new HttpRequestBuilder(BaseUrl) + var request = new HttpRequestBuilder(Settings.BaseUrl) .Resource("/api/torrents") .Build(); diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsSettings.cs index 721e7bcef..f2bdbdc6e 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDBits/HDBitsSettings.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.HDBits @@ -14,7 +13,7 @@ namespace NzbDrone.Core.Indexers.HDBits } } - public class HDBitsSettings : IProviderConfig + public class HDBitsSettings : IIndexerSettings { private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator(); @@ -24,16 +23,19 @@ namespace NzbDrone.Core.Indexers.HDBits Mediums = System.Array.Empty(); } - [FieldDefinition(0, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "API Key", Privacy = PrivacyLevel.ApiKey)] + [FieldDefinition(3, Label = "API Key", Privacy = PrivacyLevel.ApiKey)] public string ApiKey { get; set; } - [FieldDefinition(5, Label = "Codecs", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")] + [FieldDefinition(4, Label = "Codecs", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsCodec), Advanced = true, HelpText = "Options: h264, Mpeg2, VC1, Xvid. If unspecified, all options are used.")] public IEnumerable Codecs { get; set; } - [FieldDefinition(6, Label = "Mediums", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")] + [FieldDefinition(5, Label = "Mediums", Type = FieldType.TagSelect, SelectOptions = typeof(HdBitsMedium), Advanced = true, HelpText = "Options: BluRay, Encode, Capture, Remux, WebDL. If unspecified, all options are used.")] public IEnumerable Mediums { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs index 6befa6afb..45214f8c7 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/HDTorrents.cs @@ -15,7 +15,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,8 +23,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "HD-Torrents"; - public override string BaseUrl => "https://hdts.ru/"; - private string LoginUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "https://hdts.ru/" }; + public override string Description => "HD-Torrents is a private torrent website with HD torrents and strict rules on their content."; + private string LoginUrl => Settings.BaseUrl + "login.php"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -37,12 +37,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new HDTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new HDTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new HDTorrentsParser(Settings, Capabilities.Categories, BaseUrl); + return new HDTorrentsParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -141,7 +141,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public HDTorrentsSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public HDTorrentsRequestGenerator() { @@ -149,7 +148,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = BaseUrl + "torrents.php?" + string.Join(string.Empty, Capabilities.Categories.MapTorznabCapsToTrackers(categories).Select(cat => $"category[]={cat}&")); + var searchUrl = Settings.BaseUrl + "torrents.php?" + string.Join(string.Empty, Capabilities.Categories.MapTorznabCapsToTrackers(categories).Select(cat => $"category[]={cat}&")); var queryCollection = new NameValueCollection { @@ -219,7 +218,6 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly HDTorrentsSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; private readonly Regex _posterRegex = new Regex(@"src=\\'./([^']+)\\'", RegexOptions.IgnoreCase); private readonly HashSet _freeleechRanks = new HashSet(StringComparer.OrdinalIgnoreCase) @@ -232,11 +230,10 @@ namespace NzbDrone.Core.Indexers.Definitions "Owner" }; - public HDTorrentsParser(HDTorrentsSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public HDTorrentsParser(HDTorrentsSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -255,12 +252,12 @@ namespace NzbDrone.Core.Indexers.Definitions { var mainLink = row.Children[2].QuerySelector("a"); var title = mainLink.TextContent; - var details = new Uri(_baseUrl + mainLink.GetAttribute("href")); + var details = new Uri(_settings.BaseUrl + mainLink.GetAttribute("href")); var posterMatch = _posterRegex.Match(mainLink.GetAttribute("onmouseover")); - var poster = posterMatch.Success ? new Uri(_baseUrl + posterMatch.Groups[1].Value.Replace("\\", "/")) : null; + var poster = posterMatch.Success ? new Uri(_settings.BaseUrl + posterMatch.Groups[1].Value.Replace("\\", "/")) : null; - var link = new Uri(_baseUrl + row.Children[4].FirstElementChild.GetAttribute("href")); + var link = new Uri(_settings.BaseUrl + row.Children[4].FirstElementChild.GetAttribute("href")); var description = row.Children[2].QuerySelector("span").TextContent; var size = ReleaseInfo.GetBytes(row.Children[7].TextContent); @@ -365,7 +362,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class HDTorrentsSettings : IProviderConfig + public class HDTorrentsSettings : IIndexerSettings { private static readonly HDTorrentsSettingsValidator Validator = new HDTorrentsSettingsValidator(); @@ -375,10 +372,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Headphones/Headphones.cs b/src/NzbDrone.Core/Indexers/Definitions/Headphones/Headphones.cs index 102ea2bab..d19ddabeb 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Headphones/Headphones.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Headphones/Headphones.cs @@ -17,7 +17,8 @@ namespace NzbDrone.Core.Indexers.Headphones public override DownloadProtocol Protocol => DownloadProtocol.Usenet; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; - public override string BaseUrl => "https://indexer.codeshy.com"; + public override string[] IndexerUrls => new string[] { "https://indexer.codeshy.com" }; + public override string Description => ""; public override IndexerCapabilities Capabilities => SetCapabilities(); public override IIndexerRequestGenerator GetRequestGenerator() @@ -26,8 +27,7 @@ namespace NzbDrone.Core.Indexers.Headphones { PageSize = PageSize, Settings = Settings, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs index 11db5c9c7..22eca7982 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRequestGenerator.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Headphones public int PageSize { get; set; } public HeadphonesSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } + public Func> GetCookies { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } @@ -106,7 +106,7 @@ namespace NzbDrone.Core.Indexers.Headphones private IEnumerable GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters) { - var baseUrl = string.Format("{0}{1}?t={2}&extended=1", BaseUrl.TrimEnd('/'), Settings.ApiPath.TrimEnd('/'), searchCriteria.SearchType); + var baseUrl = string.Format("{0}{1}?t={2}&extended=1", Settings.BaseUrl.TrimEnd('/'), Settings.ApiPath.TrimEnd('/'), searchCriteria.SearchType); var categories = searchCriteria.Categories; if (categories != null && categories.Any()) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesSettings.cs index 129397008..e805206dd 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Headphones @@ -14,7 +13,7 @@ namespace NzbDrone.Core.Indexers.Headphones } } - public class HeadphonesSettings : IProviderConfig + public class HeadphonesSettings : IIndexerSettings { private static readonly HeadphonesSettingsValidator Validator = new HeadphonesSettingsValidator(); @@ -28,10 +27,13 @@ namespace NzbDrone.Core.Indexers.Headphones public string ApiKey { get; set; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] public string Password { get; set; } public virtual NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs index 5b4e7895c..8687a7d22 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/IPTorrents.cs @@ -13,7 +13,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 @@ -22,7 +21,8 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "IPTorrents"; - public override string BaseUrl => "https://iptorrents.com/"; + public override string[] IndexerUrls => new string[] { "https://iptorrents.com/" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -34,12 +34,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new IPTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new IPTorrentsRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new IPTorrentsParser(Settings, Capabilities.Categories, BaseUrl); + return new IPTorrentsParser(Settings, Capabilities.Categories); } protected override IDictionary GetCookies() @@ -148,7 +148,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public IPTorrentsSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public IPTorrentsRequestGenerator() { @@ -156,7 +155,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = BaseUrl + "t"; + var searchUrl = Settings.BaseUrl + "t"; var qc = new NameValueCollection(); @@ -234,13 +233,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly IPTorrentsSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public IPTorrentsParser(IPTorrentsSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public IPTorrentsParser(IPTorrentsSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -263,10 +260,10 @@ namespace NzbDrone.Core.Indexers.Definitions // drop invalid char that seems to have cropped up in some titles. #6582 var title = qTitleLink.TextContent.Trim().Replace("\u000f", ""); - var details = new Uri(_baseUrl + qTitleLink.GetAttribute("href").TrimStart('/')); + var details = new Uri(_settings.BaseUrl + qTitleLink.GetAttribute("href").TrimStart('/')); var qLink = row.QuerySelector("a[href^=\"/download.php/\"]"); - var link = new Uri(_baseUrl + qLink.GetAttribute("href").TrimStart('/')); + var link = new Uri(_settings.BaseUrl + qLink.GetAttribute("href").TrimStart('/')); var descrSplit = row.QuerySelector("div.sub").TextContent.Split('|'); var dateSplit = descrSplit.Last().Split(new[] { " by " }, StringSplitOptions.None); @@ -337,7 +334,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class IPTorrentsSettings : IProviderConfig + public class IPTorrentsSettings : IIndexerSettings { private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator(); @@ -346,9 +343,10 @@ namespace NzbDrone.Core.Indexers.Definitions 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(1, Label = "Cookie", HelpText = "Site Cookie")] + [FieldDefinition(2, Label = "Cookie", HelpText = "Site Cookie")] public string Cookie { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs b/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs index 505596282..b9d978a6b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ImmortalSeed.cs @@ -25,8 +25,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "ImmortalSeed"; - public override string BaseUrl => "https://immortalseed.me/"; - private string LoginUrl => BaseUrl + "takelogin.php"; + public override string[] IndexerUrls => new string[] { "https://immortalseed.me/" }; + public override string Description => "ImmortalSeed (iS) is a Private Torrent Tracker for MOVIES / TV / GENERAL"; + private string LoginUrl => Settings.BaseUrl + "takelogin.php"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -38,12 +39,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new ImmortalSeedRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new ImmortalSeedRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new ImmortalSeedParser(Settings, Capabilities.Categories, BaseUrl); + return new ImmortalSeedParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -161,7 +162,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public ImmortalSeedSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public ImmortalSeedRequestGenerator() { @@ -169,7 +169,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = BaseUrl + "browse.php"; + var searchUrl = Settings.BaseUrl + "browse.php"; //TODO - Actually map some categories here if (term.IsNotNullOrWhiteSpace()) @@ -235,13 +235,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly ImmortalSeedSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public ImmortalSeedParser(ImmortalSeedSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public ImmortalSeedParser(ImmortalSeedSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -335,7 +333,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class ImmortalSeedSettings : IProviderConfig + public class ImmortalSeedSettings : IIndexerSettings { private static readonly ImmortalSeedSettingsValidator Validator = new ImmortalSeedSettingsValidator(); @@ -345,10 +343,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Milkie.cs b/src/NzbDrone.Core/Indexers/Definitions/Milkie.cs index 7be0accfb..8ff4a921c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Milkie.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Milkie.cs @@ -11,7 +11,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 @@ -20,7 +19,8 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "Milkie"; - public override string BaseUrl => "https://milkie.cc/"; + public override string[] IndexerUrls => new string[] { "https://milkie.cc/" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -32,12 +32,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new MilkieRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new MilkieRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new MilkieParser(Settings, Capabilities.Categories, BaseUrl); + return new MilkieParser(Settings, Capabilities.Categories); } private IndexerCapabilities SetCapabilities() @@ -77,7 +77,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public MilkieSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public MilkieRequestGenerator() { @@ -85,7 +84,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = BaseUrl + "api/v1/torrents"; + var searchUrl = Settings.BaseUrl + "api/v1/torrents"; var qc = new NameValueCollection { @@ -164,13 +163,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly MilkieSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public MilkieParser(MilkieSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public MilkieParser(MilkieSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -186,9 +183,9 @@ namespace NzbDrone.Core.Indexers.Definitions foreach (var torrent in response.Torrents) { - var torrentUrl = _baseUrl + "api/v1/torrents"; + var torrentUrl = _settings.BaseUrl + "api/v1/torrents"; var link = $"{torrentUrl}/{torrent.Id}/torrent?{dlQueryParams.GetQueryString()}"; - var details = $"{_baseUrl}browse/{torrent.Id}"; + var details = $"{_settings.BaseUrl}browse/{torrent.Id}"; var publishDate = DateTimeUtil.FromUnknown(torrent.CreatedAt); var release = new TorrentInfo @@ -226,7 +223,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class MilkieSettings : IProviderConfig + public class MilkieSettings : IIndexerSettings { private static readonly MilkieSettingsValidator Validator = new MilkieSettingsValidator(); @@ -235,9 +232,10 @@ namespace NzbDrone.Core.Indexers.Definitions ApiKey = ""; } + [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(1, Label = "Apikey", HelpText = "Site ApiKey", Privacy = PrivacyLevel.ApiKey)] + [FieldDefinition(2, Label = "Apikey", HelpText = "Site ApiKey", Privacy = PrivacyLevel.ApiKey)] public string ApiKey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs b/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs index ca59077cf..699e12ef4 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/MyAnonamouse.cs @@ -13,7 +13,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 @@ -22,7 +21,8 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "MyAnonamouse"; - public override string BaseUrl => "https://www.myanonamouse.net/"; + public override string[] IndexerUrls => new string[] { "https://www.myanonamouse.net/" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -34,12 +34,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new MyAnonamouseRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new MyAnonamouseRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new MyAnonamouseParser(Settings, Capabilities.Categories, BaseUrl); + return new MyAnonamouseParser(Settings, Capabilities.Categories); } protected override IDictionary GetCookies() @@ -160,7 +160,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public MyAnonamouseSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public MyAnonamouseRequestGenerator() { @@ -202,7 +201,7 @@ namespace NzbDrone.Core.Indexers.Definitions qParams.Add("tor[cat][]", "0"); } - var urlSearch = BaseUrl + "tor/js/loadSearchJSONbasic.php"; + var urlSearch = Settings.BaseUrl + "tor/js/loadSearchJSONbasic.php"; if (qParams.Count > 0) { @@ -261,13 +260,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly MyAnonamouseSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public MyAnonamouseParser(MyAnonamouseSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public MyAnonamouseParser(MyAnonamouseSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -331,8 +328,8 @@ namespace NzbDrone.Core.Indexers.Definitions var category = item.Category; release.Categories = _categories.MapTrackerCatToNewznab(category); - release.DownloadUrl = _baseUrl + "/tor/download.php?tid=" + id; - release.InfoUrl = _baseUrl + "/t/" + id; + release.DownloadUrl = _settings.BaseUrl + "/tor/download.php?tid=" + id; + release.InfoUrl = _settings.BaseUrl + "/t/" + id; release.Guid = release.InfoUrl; var dateStr = item.Added; @@ -366,7 +363,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class MyAnonamouseSettings : IProviderConfig + public class MyAnonamouseSettings : IIndexerSettings { private static readonly MyAnonamouseSettingsValidator Validator = new MyAnonamouseSettingsValidator(); @@ -375,10 +372,13 @@ namespace NzbDrone.Core.Indexers.Definitions MamId = ""; } - [FieldDefinition(1, Label = "Mam Id", HelpText = "Mam Session Id (Created Under Profile -> Security)")] + [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 = "Mam Id", HelpText = "Mam Session Id (Created Under Profile -> Security)")] public string MamId { get; set; } - [FieldDefinition(2, Type = FieldType.Checkbox, Label = "Exclude VIP", HelpText = "Exclude VIP Torrents from search results")] + [FieldDefinition(3, Type = FieldType.Checkbox, Label = "Exclude VIP", HelpText = "Exclude VIP Torrents from search results")] public bool ExcludeVip { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs index c5ea066e4..23f0516c0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Nebulance.cs @@ -15,7 +15,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 @@ -23,8 +22,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class Nebulance : TorrentIndexerBase { public override string Name => "Nebulance"; - public override string BaseUrl => "https://nebulance.io/"; - private string LoginUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "https://nebulance.io/" }; + private string LoginUrl => Settings.BaseUrl + "login.php"; public override string Description => "At Nebulance we will change the way you think about TV"; public override string Language => "en-us"; public override Encoding Encoding => Encoding.UTF8; @@ -39,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new NebulanceRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new NebulanceRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new NebulanceParser(Settings, Capabilities.Categories, BaseUrl); + return new NebulanceParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -109,7 +108,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public NebulanceSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public NebulanceRequestGenerator() { @@ -117,7 +115,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories) { - var searchUrl = string.Format("{0}/torrents.php", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/torrents.php", Settings.BaseUrl.TrimEnd('/')); var searchTerm = term; @@ -188,13 +186,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly NebulanceSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public NebulanceParser(NebulanceSettings settings, IndexerCapabilitiesCategories categories, string baseurl) + public NebulanceParser(NebulanceSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseurl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -224,8 +220,8 @@ namespace NzbDrone.Core.Indexers.Definitions var posterStr = row.QuerySelector("img")?.GetAttribute("src"); Uri.TryCreate(posterStr, UriKind.Absolute, out var poster); - var details = _baseUrl + row.QuerySelector("a[data-src]").GetAttribute("href"); - var link = _baseUrl + row.QuerySelector("a[href*='action=download']").GetAttribute("href"); + var details = _settings.BaseUrl + row.QuerySelector("a[data-src]").GetAttribute("href"); + var link = _settings.BaseUrl + row.QuerySelector("a[href*='action=download']").GetAttribute("href"); var qColSize = row.QuerySelector("td:nth-child(3)"); var size = ReleaseInfo.GetBytes(qColSize.Children[0].TextContent); @@ -278,7 +274,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class NebulanceSettings : IProviderConfig + public class NebulanceSettings : IIndexerSettings { private static readonly NebulanceSettingsValidator Validator = new NebulanceSettingsValidator(); @@ -289,13 +285,16 @@ namespace NzbDrone.Core.Indexers.Definitions TwoFactorAuth = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Privacy = PrivacyLevel.Password, Type = FieldType.Password, HelpText = "Site Password")] public string Password { get; set; } - [FieldDefinition(3, Label = "Two Factor Auth", HelpText = "Two-Factor Auth")] + [FieldDefinition(4, Label = "Two Factor Auth", HelpText = "Two-Factor Auth")] public string TwoFactorAuth { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Definitions/Newznab/Newznab.cs index bebf5c4f2..faceed2f3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Newznab/Newznab.cs @@ -19,7 +19,8 @@ namespace NzbDrone.Core.Indexers.Newznab private readonly INewznabCapabilitiesProvider _capabilitiesProvider; public override string Name => "Newznab"; - public override string BaseUrl => GetBaseUrlFromSettings(); + public override string[] IndexerUrls => GetBaseUrlFromSettings(); + public override string Description => ""; public override bool FollowRedirect => true; public override bool SupportsRedirect => true; @@ -44,16 +45,16 @@ namespace NzbDrone.Core.Indexers.Newznab return new NewznabRssParser(Settings); } - public string GetBaseUrlFromSettings() + public string[] GetBaseUrlFromSettings() { var baseUrl = ""; if (Definition == null || Settings == null || Settings.Categories == null) { - return baseUrl; + return new string[] { baseUrl }; } - return Settings.BaseUrl; + return new string[] { Settings.BaseUrl }; } public IndexerCapabilities GetCapabilitiesFromSettings() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabSettings.cs index 67e1159ca..5c502ddf3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabSettings.cs @@ -4,7 +4,6 @@ using System.Text.RegularExpressions; using FluentValidation; using NzbDrone.Common.Extensions; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Newznab @@ -52,7 +51,7 @@ namespace NzbDrone.Core.Indexers.Newznab } } - public class NewznabSettings : IProviderConfig + public class NewznabSettings : IIndexerSettings { private static readonly NewznabSettingsValidator Validator = new NewznabSettingsValidator(); diff --git a/src/NzbDrone.Core/Indexers/Definitions/NotWhatCD.cs b/src/NzbDrone.Core/Indexers/Definitions/NotWhatCD.cs index c3319cd2b..a71aba507 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/NotWhatCD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/NotWhatCD.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class NotWhatCD : Gazelle.Gazelle { public override string Name => "notwhat.cd"; - public override string BaseUrl => "https://notwhat.cd/"; + public override string[] IndexerUrls => new string[] { "https://notwhat.cd/" }; + public override string Description => ""; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public NotWhatCD(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs index ca141faaf..9b6594780 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class Orpheus : Gazelle.Gazelle { public override string Name => "Orpheus"; - public override string BaseUrl => "https://orpheus.network/"; + public override string[] IndexerUrls => new string[] { "https://orpheus.network/" }; + public override string Description => ""; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public Orpheus(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs index b3471937e..a7dc63a15 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcorn.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn public class PassThePopcorn : TorrentIndexerBase { public override string Name => "PassThePopcorn"; - public override string BaseUrl => "https://passthepopcorn.me"; + public override string[] IndexerUrls => new string[] { "https://passthepopcorn.me" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override bool SupportsRss => true; @@ -36,8 +37,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn { Settings = Settings, HttpClient = _httpClient, - Logger = _logger, - BaseUrl = BaseUrl + Logger = _logger }; } @@ -80,7 +80,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn public override IParseIndexerResponse GetParser() { - return new PassThePopcornParser(BaseUrl, Capabilities, _logger); + return new PassThePopcornParser(Settings, Capabilities, _logger); } } diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs index d0a95914c..7086788b0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornParser.cs @@ -12,12 +12,12 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn { public class PassThePopcornParser : IParseIndexerResponse { - private readonly string _baseUrl; private readonly IndexerCapabilities _capabilities; + private readonly PassThePopcornSettings _settings; private readonly Logger _logger; - public PassThePopcornParser(string baseUrl, IndexerCapabilities capabilities, Logger logger) + public PassThePopcornParser(PassThePopcornSettings settings, IndexerCapabilities capabilities, Logger logger) { - _baseUrl = baseUrl; + _settings = settings; _capabilities = capabilities; _logger = logger; } @@ -133,7 +133,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn private string GetDownloadUrl(int torrentId, string authKey, string passKey) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") .AddQueryParam("id", torrentId) @@ -145,7 +145,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn private string GetInfoUrl(string groupId, int torrentId) { - var url = new HttpUri(_baseUrl) + var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("id", groupId) .AddQueryParam("torrentid", torrentId); diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs index 99228224f..77fb4c6ee 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornRequestGenerator.cs @@ -9,7 +9,6 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn { public class PassThePopcornRequestGenerator : IIndexerRequestGenerator { - public string BaseUrl { get; set; } public PassThePopcornSettings Settings { get; set; } public IDictionary Cookies { get; set; } @@ -40,7 +39,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn { var request = new IndexerRequest( - $"{BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}", + $"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}", HttpAccept.Json); request.HttpRequest.Headers["ApiUser"] = Settings.APIUser; diff --git a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs index 6994a4d04..67935b573 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PassThePopcorn/PassThePopcornSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.PassThePopcorn @@ -14,7 +13,7 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn } } - public class PassThePopcornSettings : IProviderConfig + public class PassThePopcornSettings : IIndexerSettings { private static readonly PassThePopcornSettingsValidator Validator = new PassThePopcornSettingsValidator(); @@ -22,10 +21,13 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn { } - [FieldDefinition(0, Label = "APIUser", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)] + [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 = "APIUser", HelpText = "These settings are found in your PassThePopcorn security settings (Edit Profile > Security).", Privacy = PrivacyLevel.UserName)] public string APIUser { get; set; } - [FieldDefinition(1, Label = "APIKey", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "APIKey", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] public string APIKey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs b/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs index 199599c46..01eb3e8d8 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PreToMe.cs @@ -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,9 +23,9 @@ namespace NzbDrone.Core.Indexers.Definitions public class PreToMe : TorrentIndexerBase { public override string Name => "PreToMe"; - public override string BaseUrl => "https://pretome.info/"; + public override string[] IndexerUrls => new string[] { "https://pretome.info/" }; public override string Description => "BitTorrent site for High Quality, High Definition (HD) movies and TV Shows"; - private string LoginUrl => BaseUrl + "takelogin.php"; + private string LoginUrl => Settings.BaseUrl + "takelogin.php"; public override string Language => "en-us"; public override Encoding Encoding => Encoding.GetEncoding("iso-8859-1"); public override DownloadProtocol Protocol => DownloadProtocol.Torrent; @@ -40,12 +39,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new PreToMeRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new PreToMeRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new PreToMeParser(Settings, Capabilities.Categories, BaseUrl); + return new PreToMeParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -58,7 +57,7 @@ namespace NzbDrone.Core.Indexers.Definitions AllowAutoRedirect = true }; - var loginPage = await _httpClient.ExecuteAsync(new HttpRequest(BaseUrl + "login.php")); + var loginPage = await _httpClient.ExecuteAsync(new HttpRequest(Settings.BaseUrl + "login.php")); requestBuilder.Method = HttpMethod.POST; requestBuilder.PostProcess += r => r.RequestTimeout = TimeSpan.FromSeconds(15); @@ -185,7 +184,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public PreToMeSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public PreToMeRequestGenerator() { @@ -193,7 +191,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = string.Format("{0}/browse.php", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/browse.php", Settings.BaseUrl.TrimEnd('/')); var qc = new List> // NameValueCollection don't support cat[]=19&cat[]=6 { @@ -311,13 +309,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly PreToMeSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public PreToMeParser(PreToMeSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public PreToMeParser(PreToMeSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -341,8 +337,8 @@ namespace NzbDrone.Core.Indexers.Definitions //{ // continue; // we have to skip bad titles due to tags + any word search //} - var details = _baseUrl + qLink.GetAttribute("href"); - var link = _baseUrl + row.Children[2].QuerySelector("a").GetAttribute("href"); + var details = _settings.BaseUrl + qLink.GetAttribute("href"); + var link = _settings.BaseUrl + row.Children[2].QuerySelector("a").GetAttribute("href"); var dateStr = Regex.Replace(row.Children[5].InnerHtml, @"\", " "); var publishDate = DateTimeUtil.FromTimeAgo(dateStr); var files = ParseUtil.CoerceInt(row.Children[3].TextContent); @@ -390,7 +386,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class PreToMeSettings : IProviderConfig + public class PreToMeSettings : IIndexerSettings { private static readonly PreToMeSettingsValidator Validator = new PreToMeSettingsValidator(); @@ -401,13 +397,16 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Pin", HelpText = "Site Pin")] + [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 = "Pin", HelpText = "Site Pin")] public string Pin { get; set; } - [FieldDefinition(2, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [FieldDefinition(3, Label = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(3, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(4, Label = "Password", Privacy = PrivacyLevel.Password, Type = FieldType.Password, HelpText = "Site Password")] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs b/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs index b47b84ceb..74d4880ce 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/PrivateHD.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class PrivateHD : Avistaz.AvistazBase { public override string Name => "PrivateHD"; - public override string BaseUrl => "https://privatehd.to/"; + public override string[] IndexerUrls => new string[] { "https://privatehd.to/" }; + public override string Description => ""; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public PrivateHD(IIndexerRepository indexerRepository, IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) @@ -25,8 +26,7 @@ namespace NzbDrone.Core.Indexers.Definitions Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/Rarbg.cs b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/Rarbg.cs index 2386d8f74..d80f0c8f3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/Rarbg.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/Rarbg.cs @@ -16,7 +16,8 @@ namespace NzbDrone.Core.Indexers.Rarbg private readonly IRarbgTokenProvider _tokenProvider; public override string Name => "Rarbg"; - public override string BaseUrl => "https://torrentapi.org"; + public override string[] IndexerUrls => new string[] { "https://torrentapi.org" }; + public override string Description => "RARBG is a Public torrent site for MOVIES / TV / GENERAL"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; @@ -34,7 +35,7 @@ namespace NzbDrone.Core.Indexers.Rarbg public override IIndexerRequestGenerator GetRequestGenerator() { - return new RarbgRequestGenerator(_tokenProvider) { Settings = Settings, Categories = Capabilities.Categories, BaseUrl = BaseUrl }; + return new RarbgRequestGenerator(_tokenProvider) { Settings = Settings, Categories = Capabilities.Categories }; } public override IParseIndexerResponse GetParser() @@ -105,7 +106,7 @@ namespace NzbDrone.Core.Indexers.Rarbg try { - var request = new HttpRequestBuilder(BaseUrl.Trim('/')) + var request = new HttpRequestBuilder(Settings.BaseUrl.Trim('/')) .Resource("/pubapi_v2.php?get_token=get_token") .Accept(HttpAccept.Json) .Build(); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs index 5ff330247..b32899ed0 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgRequestGenerator.cs @@ -12,7 +12,6 @@ namespace NzbDrone.Core.Indexers.Rarbg { private readonly IRarbgTokenProvider _tokenProvider; - public string BaseUrl { get; set; } public RarbgSettings Settings { get; set; } public IndexerCapabilitiesCategories Categories { get; set; } @@ -23,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Rarbg private IEnumerable GetRequest(string term, int[] categories, string imdbId = null, int? tmdbId = null) { - var requestBuilder = new HttpRequestBuilder(BaseUrl) + var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl) .Resource("/pubapi_v2.php") .Accept(HttpAccept.Json); @@ -62,7 +61,7 @@ namespace NzbDrone.Core.Indexers.Rarbg } requestBuilder.AddQueryParam("limit", "100"); - requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings, BaseUrl)); + requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings, Settings.BaseUrl)); requestBuilder.AddQueryParam("format", "json_extended"); requestBuilder.AddQueryParam("app_id", BuildInfo.AppName); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgSettings.cs index 2a35affa0..9a8624d68 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Rarbg/RarbgSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Rarbg @@ -12,7 +11,7 @@ namespace NzbDrone.Core.Indexers.Rarbg } } - public class RarbgSettings : IProviderConfig + public class RarbgSettings : IIndexerSettings { private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator(); @@ -21,10 +20,13 @@ namespace NzbDrone.Core.Indexers.Rarbg RankedOnly = false; } - [FieldDefinition(1, Type = FieldType.Checkbox, Label = "Ranked Only", HelpText = "Only include ranked results.")] + [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, Type = FieldType.Checkbox, Label = "Ranked Only", HelpText = "Only include ranked results.")] public bool RankedOnly { get; set; } - [FieldDefinition(2, Type = FieldType.Captcha, Label = "CAPTCHA Token", HelpText = "CAPTCHA Clearance token used to handle CloudFlare Anti-DDOS measures on shared-ip VPNs.")] + [FieldDefinition(3, Type = FieldType.Captcha, Label = "CAPTCHA Token", HelpText = "CAPTCHA Clearance token used to handle CloudFlare Anti-DDOS measures on shared-ip VPNs.")] public string CaptchaToken { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs index aabfd1846..ae9ae324d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class Redacted : Gazelle.Gazelle { public override string Name => "Redacted"; - public override string BaseUrl => "https://redacted.ch/"; + public override string[] IndexerUrls => new string[] { "https://redacted.ch/" }; + public override string Description => ""; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public Redacted(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) diff --git a/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs b/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs index 34206c75d..303b9085c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/RevolutionTT.cs @@ -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 @@ -25,8 +24,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "RevolutionTT"; - public override string BaseUrl => "https://revolutiontt.me/"; - private string LoginUrl => BaseUrl + "takelogin.php"; + public override string[] IndexerUrls => new string[] { "https://revolutiontt.me/" }; + public override string Description => "The Revolution has begun"; + private string LoginUrl => Settings.BaseUrl + "takelogin.php"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -38,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new RevolutionTTRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new RevolutionTTRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new RevolutionTTParser(Settings, Capabilities.Categories, BaseUrl); + return new RevolutionTTParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -56,7 +56,7 @@ namespace NzbDrone.Core.Indexers.Definitions AllowAutoRedirect = true }; - var loginPage = await _httpClient.ExecuteAsync(new HttpRequest(BaseUrl + "login.php")); + var loginPage = await _httpClient.ExecuteAsync(new HttpRequest(Settings.BaseUrl + "login.php")); requestBuilder.Method = HttpMethod.POST; requestBuilder.PostProcess += r => r.RequestTimeout = TimeSpan.FromSeconds(15); @@ -155,7 +155,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public RevolutionTTSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public RevolutionTTRequestGenerator() { @@ -189,7 +188,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - var searchUrl = BaseUrl + "browse.php?" + qc.GetQueryString(); + var searchUrl = Settings.BaseUrl + "browse.php?" + qc.GetQueryString(); var request = new IndexerRequest(searchUrl, HttpAccept.Html); @@ -249,13 +248,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly RevolutionTTSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public RevolutionTTParser(RevolutionTTSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public RevolutionTTParser(RevolutionTTSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -269,7 +266,7 @@ namespace NzbDrone.Core.Indexers.Definitions foreach (var row in rows.Skip(1)) { var qDetails = row.QuerySelector(".br_right > a"); - var details = _baseUrl + qDetails.GetAttribute("href"); + var details = _settings.BaseUrl + qDetails.GetAttribute("href"); var title = qDetails.QuerySelector("b").TextContent; var qLink = row.QuerySelector("td:nth-child(4) > a"); @@ -278,7 +275,7 @@ namespace NzbDrone.Core.Indexers.Definitions continue; // support/donation banner } - var link = _baseUrl + qLink.GetAttribute("href"); + var link = _settings.BaseUrl + qLink.GetAttribute("href"); // dateString format "yyyy-MMM-dd hh:mm:ss" => eg "2015-04-25 23:38:12" var dateString = row.QuerySelector("td:nth-child(6) nobr").TextContent.Trim(); @@ -333,7 +330,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class RevolutionTTSettings : IProviderConfig + public class RevolutionTTSettings : IIndexerSettings { private static readonly RevolutionTTSettingsValidator Validator = new RevolutionTTSettingsValidator(); @@ -343,10 +340,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/ShareIsland.cs b/src/NzbDrone.Core/Indexers/Definitions/ShareIsland.cs index df99ec6bc..29de8d18b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ShareIsland.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ShareIsland.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class ShareIsland : Unit3dBase { public override string Name => "ShareIsland"; - public override string BaseUrl => "https://shareisland.org/"; + public override string[] IndexerUrls => new string[] { "https://shareisland.org/" }; public override string Description => "A general italian tracker"; public override string Language => "it-it"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; diff --git a/src/NzbDrone.Core/Indexers/Definitions/ShowRSS.cs b/src/NzbDrone.Core/Indexers/Definitions/ShowRSS.cs index dd124e7a0..7aa3e9c76 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ShowRSS.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ShowRSS.cs @@ -6,6 +6,7 @@ using System.Xml; using FluentValidation; using NLog; using NzbDrone.Common.Http; +using NzbDrone.Core.Annotations; using NzbDrone.Core.Configuration; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Messaging.Events; @@ -18,7 +19,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class ShowRSS : TorrentIndexerBase { public override string Name => "ShowRSS"; - public override string BaseUrl => "https://showrss.info/"; + public override string[] IndexerUrls => new string[] { "https://showrss.info/" }; public override string Language => "en-us"; public override string Description => "showRSS is a service that allows you to keep track of your favorite TV shows"; public override Encoding Encoding => Encoding.UTF8; @@ -33,12 +34,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new ShowRSSRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new ShowRSSRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new ShowRSSParser(BaseUrl); + return new ShowRSSParser(Settings); } private IndexerCapabilities SetCapabilities() @@ -63,7 +64,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public ShowRSSSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public ShowRSSRequestGenerator() { @@ -71,7 +71,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories) { - var searchUrl = string.Format("{0}/other/all.rss", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/other/all.rss", Settings.BaseUrl.TrimEnd('/')); var request = new IndexerRequest(searchUrl, HttpAccept.Html); @@ -123,12 +123,12 @@ namespace NzbDrone.Core.Indexers.Definitions public class ShowRSSParser : IParseIndexerResponse { - private readonly string _baseUrl; - private string BrowseUrl => _baseUrl + "browse/"; + private readonly ShowRSSSettings _settings; + private string BrowseUrl => _settings.BaseUrl + "browse/"; - public ShowRSSParser(string baseurl) + public ShowRSSParser(ShowRSSSettings settings) { - _baseUrl = baseurl; + _settings = settings; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -184,10 +184,13 @@ namespace NzbDrone.Core.Indexers.Definitions { } - public class ShowRSSSettings : IProviderConfig + public class ShowRSSSettings : IIndexerSettings { private static readonly ShowRSSSettingsValidator Validator = new ShowRSSSettingsValidator(); + [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; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/Definitions/SpeedApp.cs b/src/NzbDrone.Core/Indexers/Definitions/SpeedApp.cs index 7cb5e140f..4a900d7a1 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SpeedApp.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SpeedApp.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; @@ -28,9 +28,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "SpeedApp.io"; - public override string BaseUrl => "https://speedapp.io"; + public override string[] IndexerUrls => new string[] { "https://speedapp.io" }; - private string ApiUrl => $"{BaseUrl}/api"; + private string ApiUrl => $"{Settings.BaseUrl}/api"; private string LoginUrl => $"{ApiUrl}/login"; @@ -56,12 +56,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new SpeedAppRequestGenerator(Capabilities, Settings, ApiUrl); + return new SpeedAppRequestGenerator(Capabilities, Settings); } public override IParseIndexerResponse GetParser() { - return new SpeedAppParser(ApiUrl); + return new SpeedAppParser(Settings); } protected override bool CheckIfLoginNeeded(HttpResponse httpResponse) @@ -262,13 +262,10 @@ namespace NzbDrone.Core.Indexers.Definitions private SpeedAppSettings Settings { get; } - private string BaseUrl { get; } - - public SpeedAppRequestGenerator(IndexerCapabilities capabilities, SpeedAppSettings settings, string baseUrl) + public SpeedAppRequestGenerator(IndexerCapabilities capabilities, SpeedAppSettings settings) { Capabilities = capabilities; Settings = settings; - BaseUrl = baseUrl; } public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria) @@ -338,7 +335,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - var searchUrl = BaseUrl + "/torrent?" + qc.GetQueryString(); + var searchUrl = Settings.BaseUrl + "/api/torrent?" + qc.GetQueryString(); var request = new IndexerRequest(searchUrl, HttpAccept.Json); @@ -350,13 +347,13 @@ namespace NzbDrone.Core.Indexers.Definitions public class SpeedAppParser : IParseIndexerResponse { - public string BaseUrl { get; set; } + public SpeedAppSettings Settings { get; set; } public Action, DateTime?> CookiesUpdater { get; set; } - public SpeedAppParser(string baseUrl) + public SpeedAppParser(SpeedAppSettings settings) { - BaseUrl = baseUrl; + Settings = settings; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -380,7 +377,7 @@ namespace NzbDrone.Core.Indexers.Definitions Description = torrent.ShortDescription, Size = torrent.Size, ImdbId = ParseUtil.GetImdbID(torrent.ImdbId).GetValueOrDefault(), - DownloadUrl = $"{BaseUrl}/torrent/{torrent.Id}/download", + DownloadUrl = $"{Settings.BaseUrl}/api/torrent/{torrent.Id}/download", InfoUrl = torrent.Url, Grabs = torrent.TimesCompleted, PublishDate = torrent.CreatedAt, @@ -405,7 +402,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class SpeedAppSettings : IProviderConfig + public class SpeedAppSettings : IIndexerSettings { private static readonly SpeedAppSettingsValidator Validator = new (); @@ -415,13 +412,16 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Email", HelpText = "Site email")] + [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 = "Email", HelpText = "Site email")] public string Email { get; set; } - [FieldDefinition(1, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", HelpText = "Site Password", Privacy = PrivacyLevel.Password, Type = FieldType.Password)] public string Password { get; set; } - [FieldDefinition(0, Label = "Api Key", Hidden = HiddenType.Hidden)] + [FieldDefinition(4, Label = "Api Key", Hidden = HiddenType.Hidden)] public string ApiKey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs b/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs index ded167882..106923e8c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SubsPlease.cs @@ -7,13 +7,13 @@ using System.Text.RegularExpressions; using FluentValidation; using NLog; using NzbDrone.Common.Http; +using NzbDrone.Core.Annotations; using NzbDrone.Core.Configuration; using NzbDrone.Core.Indexers.Exceptions; 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 @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class SubsPlease : TorrentIndexerBase { public override string Name => "SubsPlease"; - public override string BaseUrl => "https://subsplease.org/"; + public override string[] IndexerUrls => new string[] { "https://subsplease.org/" }; public override string Language => "en-us"; public override string Description => "SubsPlease - A better HorribleSubs/Erai replacement"; public override Encoding Encoding => Encoding.UTF8; @@ -36,12 +36,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new SubsPleaseRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new SubsPleaseRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new SubsPleaseParser(Settings, Capabilities.Categories, BaseUrl); + return new SubsPleaseParser(Settings, Capabilities.Categories); } private IndexerCapabilities SetCapabilities() @@ -64,7 +64,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public SubsPleaseSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public SubsPleaseRequestGenerator() { @@ -72,7 +71,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetSearchRequests(string term) { - var searchUrl = string.Format("{0}/api/?", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/api/?", Settings.BaseUrl.TrimEnd('/')); string searchTerm = Regex.Replace(term, "\\[?SubsPlease\\]?\\s*", string.Empty, RegexOptions.IgnoreCase).Trim(); @@ -97,7 +96,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetRssRequest() { - var searchUrl = string.Format("{0}/api/?", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/api/?", Settings.BaseUrl.TrimEnd('/')); var queryParameters = new NameValueCollection { @@ -171,13 +170,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly SubsPleaseSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public SubsPleaseParser(SubsPleaseSettings settings, IndexerCapabilitiesCategories categories, string baseurl) + public SubsPleaseParser(SubsPleaseSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseurl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -205,7 +202,7 @@ namespace NzbDrone.Core.Indexers.Definitions { var release = new TorrentInfo { - InfoUrl = _baseUrl + $"shows/{r.Page}/", + InfoUrl = _settings.BaseUrl + $"shows/{r.Page}/", PublishDate = r.Release_Date.DateTime, Files = 1, Categories = new List { NewznabStandardCategory.TVAnime }, @@ -255,10 +252,13 @@ namespace NzbDrone.Core.Indexers.Definitions { } - public class SubsPleaseSettings : IProviderConfig + public class SubsPleaseSettings : IIndexerSettings { private static readonly SubsPleaseSettingsValidator Validator = new SubsPleaseSettingsValidator(); + [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; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/Definitions/SuperBits.cs b/src/NzbDrone.Core/Indexers/Definitions/SuperBits.cs index 67340bea4..c759a5cb5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SuperBits.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SuperBits.cs @@ -14,7 +14,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 @@ -23,7 +22,8 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "SuperBits"; - public override string BaseUrl => "https://superbits.org/"; + public override string[] IndexerUrls => new string[] { "https://superbits.org/" }; + public override string Description => "Superbits is a SWEDISH Private Torrent Tracker for MOVIES / TV / GENERAL"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -35,12 +35,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new SuperBitsRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new SuperBitsRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new SuperBitsParser(Settings, Capabilities.Categories, BaseUrl); + return new SuperBitsParser(Settings, Capabilities.Categories); } protected override IDictionary GetCookies() @@ -104,7 +104,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public SuperBitsSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public SuperBitsRequestGenerator() { @@ -112,7 +111,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = BaseUrl + "api/v1/torrents"; + var searchUrl = Settings.BaseUrl + "api/v1/torrents"; // And this was option one from // https://github.com/Jackett/Jackett/pull/7166#discussion_r376817517 @@ -151,7 +150,7 @@ namespace NzbDrone.Core.Indexers.Definitions var request = new IndexerRequest(searchUrl, HttpAccept.Json); - request.HttpRequest.Headers.Add("Referer", BaseUrl); + request.HttpRequest.Headers.Add("Referer", Settings.BaseUrl); yield return request; } @@ -209,13 +208,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly SuperBitsSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public SuperBitsParser(SuperBitsSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public SuperBitsParser(SuperBitsSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -240,9 +237,9 @@ namespace NzbDrone.Core.Indexers.Definitions release.Files = row.numfiles; release.Grabs = row.times_completed; - release.InfoUrl = _baseUrl + "torrent/" + row.id.ToString() + "/"; + release.InfoUrl = _settings.BaseUrl + "torrent/" + row.id.ToString() + "/"; release.Guid = release.InfoUrl; - release.DownloadUrl = _baseUrl + "api/v1/torrents/download/" + row.id.ToString(); + release.DownloadUrl = _settings.BaseUrl + "api/v1/torrents/download/" + row.id.ToString(); if (row.frileech == 1) { @@ -329,7 +326,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class SuperBitsSettings : IProviderConfig + public class SuperBitsSettings : IIndexerSettings { private static readonly SuperBitsSettingsValidator Validator = new SuperBitsSettingsValidator(); @@ -338,9 +335,10 @@ namespace NzbDrone.Core.Indexers.Definitions 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(1, Label = "Cookie", HelpText = "Site Cookie")] + [FieldDefinition(2, Label = "Cookie", HelpText = "Site Cookie")] public string Cookie { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/ThePirateBay.cs b/src/NzbDrone.Core/Indexers/Definitions/ThePirateBay.cs index 63fac543f..b58524d49 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ThePirateBay.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ThePirateBay.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; using System.Text; -using FluentValidation; using Newtonsoft.Json; using NLog; using NzbDrone.Common.Http; @@ -13,7 +12,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 @@ -21,7 +19,8 @@ namespace NzbDrone.Core.Indexers.Definitions public class ThePirateBay : TorrentIndexerBase { public override string Name => "ThePirateBay"; - public override string BaseUrl => "https://thepiratebay.org/"; + public override string[] IndexerUrls => new string[] { "https://thepiratebay.org/" }; + public override string Description => "Pirate Bay(TPB) is the galaxy’s most resilient Public BitTorrent site"; public override string Language => "en-us"; public override Encoding Encoding => Encoding.UTF8; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; @@ -35,12 +34,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new ThePirateBayRequestGenerator() { Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new ThePirateBayRequestGenerator() { Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new ThePirateBayParser(Capabilities.Categories, BaseUrl); + return new ThePirateBayParser(Capabilities.Categories, Settings); } private IndexerCapabilities SetCapabilities() @@ -123,7 +122,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class ThePirateBayRequestGenerator : IIndexerRequestGenerator { public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } + private static string ApiUrl => "https://apibay.org/"; public ThePirateBayRequestGenerator() @@ -211,13 +210,13 @@ namespace NzbDrone.Core.Indexers.Definitions public class ThePirateBayParser : IParseIndexerResponse { + private readonly ThePirateBaySettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public ThePirateBayParser(IndexerCapabilitiesCategories categories, string baseUrl) + public ThePirateBayParser(IndexerCapabilitiesCategories categories, ThePirateBaySettings settings) { + _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -234,7 +233,7 @@ namespace NzbDrone.Core.Indexers.Definitions foreach (var item in queryResponseItems) { - var details = item.Id == 0 ? null : $"{_baseUrl}description.php?id={item.Id}"; + var details = item.Id == 0 ? null : $"{_settings.BaseUrl}description.php?id={item.Id}"; var imdbId = string.IsNullOrEmpty(item.Imdb) ? null : ParseUtil.GetImdbID(item.Imdb); var torrentItem = new TorrentInfo { @@ -262,8 +261,11 @@ namespace NzbDrone.Core.Indexers.Definitions public Action, DateTime?> CookiesUpdater { get; set; } } - public class ThePirateBaySettings : IProviderConfig + public class ThePirateBaySettings : IIndexerSettings { + [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; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(); diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs index 9b5153347..e932c1b66 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentDay.cs @@ -12,7 +12,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 @@ -21,7 +20,8 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "TorrentDay"; - public override string BaseUrl => "https://torrentday.cool/"; + public override string[] IndexerUrls => new string[] { "https://torrentday.cool/" }; + public override string Description => "TorrentDay (TD) is a Private site for TV / MOVIES / GENERAL"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -33,12 +33,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new TorrentDayRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new TorrentDayRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new TorrentDayParser(Settings, Capabilities.Categories, BaseUrl); + return new TorrentDayParser(Settings, Capabilities.Categories); } protected override IDictionary GetCookies() @@ -124,7 +124,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public TorrentDaySettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public TorrentDayRequestGenerator() { @@ -132,7 +131,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = BaseUrl + "t.json"; + var searchUrl = Settings.BaseUrl + "t.json"; var cats = Capabilities.Categories.MapTorznabCapsToTrackers(categories); if (cats.Count == 0) @@ -210,13 +209,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly TorrentDaySettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public TorrentDayParser(TorrentDaySettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public TorrentDayParser(TorrentDaySettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -230,11 +227,11 @@ namespace NzbDrone.Core.Indexers.Definitions var title = (string)row.name; var torrentId = (long)row.t; - var details = new Uri(_baseUrl + "details.php?id=" + torrentId); + var details = new Uri(_settings.BaseUrl + "details.php?id=" + torrentId); var seeders = (int)row.seeders; var imdbId = (string)row["imdb-id"]; var downloadMultiplier = (double?)row["download-multiplier"] ?? 1; - var link = new Uri(_baseUrl + "download.php/" + torrentId + "/" + torrentId + ".torrent"); + var link = new Uri(_settings.BaseUrl + "download.php/" + torrentId + "/" + torrentId + ".torrent"); var publishDate = DateTimeUtil.UnixTimestampToDateTime((long)row.ctime).ToLocalTime(); var imdb = ParseUtil.GetImdbID(imdbId) ?? 0; @@ -275,7 +272,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class TorrentDaySettings : IProviderConfig + public class TorrentDaySettings : IIndexerSettings { private static readonly TorrentDaySettingsValidator Validator = new TorrentDaySettingsValidator(); @@ -284,7 +281,10 @@ namespace NzbDrone.Core.Indexers.Definitions Cookie = ""; } - [FieldDefinition(1, Label = "Cookie", HelpText = "Site 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 = "Cookie", HelpText = "Site Cookie")] public string Cookie { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs index 414d175e4..72f648d69 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentLeech.cs @@ -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 @@ -25,8 +24,9 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "TorrentLeech"; - public override string BaseUrl => "https://www.torrentleech.org/"; - private string LoginUrl => BaseUrl + "user/account/login/"; + public override string[] IndexerUrls => new string[] { "https://www.torrentleech.org/" }; + public override string Description => "This is what happens when you seed"; + private string LoginUrl => Settings.BaseUrl + "user/account/login/"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -38,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new TorrentLeechRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new TorrentLeechRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new TorrentLeechParser(Settings, Capabilities.Categories, BaseUrl); + return new TorrentLeechParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -166,7 +166,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public TorrentLeechSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public TorrentLeechRequestGenerator() { @@ -176,7 +175,7 @@ namespace NzbDrone.Core.Indexers.Definitions { var searchString = Regex.Replace(term, @"(^|\s)-", " "); - var searchUrl = BaseUrl + "torrents/browse/list/"; + var searchUrl = Settings.BaseUrl + "torrents/browse/list/"; if (Settings.FreeLeechOnly) { @@ -260,13 +259,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly TorrentLeechSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public TorrentLeechParser(TorrentLeechSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public TorrentLeechParser(TorrentLeechSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -279,8 +276,8 @@ namespace NzbDrone.Core.Indexers.Definitions var title = row.name.ToString(); var torrentId = row.fid.ToString(); - var details = new Uri(_baseUrl + "torrent/" + torrentId); - var link = new Uri(_baseUrl + "download/" + torrentId + "/" + row.filename); + var details = new Uri(_settings.BaseUrl + "torrent/" + torrentId); + var link = new Uri(_settings.BaseUrl + "download/" + torrentId + "/" + row.filename); var publishDate = DateTime.ParseExact(row.addedTimestamp.ToString(), "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture); var seeders = (int)row.seeders; var leechers = (int)row.leechers; @@ -335,7 +332,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class TorrentLeechSettings : IProviderConfig + public class TorrentLeechSettings : IIndexerSettings { private static readonly TorrentLeechSettingsValidator Validator = new TorrentLeechSettingsValidator(); @@ -345,13 +342,16 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } - [FieldDefinition(3, Label = "FreeLeech Only", Type = FieldType.Checkbox, Advanced = true, HelpText = "Search Freeleech torrents only")] + [FieldDefinition(4, Label = "FreeLeech Only", Type = FieldType.Checkbox, Advanced = true, HelpText = "Search Freeleech torrents only")] public bool FreeLeechOnly { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotato.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotato.cs index f585e4449..e9638c821 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotato.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotato.cs @@ -9,7 +9,8 @@ namespace NzbDrone.Core.Indexers.TorrentPotato public class TorrentPotato : TorrentIndexerBase { public override string Name => "TorrentPotato"; - public override string BaseUrl => "http://127.0.0.1"; + public override string[] IndexerUrls => new string[] { "http://127.0.0.1" }; + public override string Description => ""; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; @@ -37,7 +38,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato public override IIndexerRequestGenerator GetRequestGenerator() { - return new TorrentPotatoRequestGenerator() { Settings = Settings, BaseUrl = BaseUrl }; + return new TorrentPotatoRequestGenerator() { Settings = Settings }; } public override IParseIndexerResponse GetParser() diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs index 2c2f69df0..f77e97a6d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoRequestGenerator.cs @@ -8,7 +8,6 @@ namespace NzbDrone.Core.Indexers.TorrentPotato { public class TorrentPotatoRequestGenerator : IIndexerRequestGenerator { - public string BaseUrl { get; set; } public TorrentPotatoSettings Settings { get; set; } public TorrentPotatoRequestGenerator() @@ -26,7 +25,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato private IEnumerable GetPagedRequests(string mode, int? tvdbId, string query, params object[] args) { - var requestBuilder = new HttpRequestBuilder(BaseUrl) + var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl) .Accept(HttpAccept.Json); requestBuilder.AddQueryParam("passkey", Settings.Passkey); @@ -46,7 +45,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato private IEnumerable GetMovieRequest(MovieSearchCriteria searchCriteria) { - var requestBuilder = new HttpRequestBuilder(BaseUrl) + var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl) .Accept(HttpAccept.Json); requestBuilder.AddQueryParam("passkey", Settings.Passkey); diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoSettings.cs index 630ad867f..46df349ed 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentPotato/TorrentPotatoSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.TorrentPotato @@ -12,7 +11,7 @@ namespace NzbDrone.Core.Indexers.TorrentPotato } } - public class TorrentPotatoSettings : IProviderConfig + public class TorrentPotatoSettings : IIndexerSettings { private static readonly TorrentPotatoSettingsValidator Validator = new TorrentPotatoSettingsValidator(); @@ -20,10 +19,13 @@ namespace NzbDrone.Core.Indexers.TorrentPotato { } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "The username you use at your indexer.", Privacy = PrivacyLevel.UserName)] public string User { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Passkey", HelpText = "The password you use at your Indexer.", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] public string Passkey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/TorrentSeeds.cs b/src/NzbDrone.Core/Indexers/Definitions/TorrentSeeds.cs index 5b1a4666f..cd7049b11 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/TorrentSeeds.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/TorrentSeeds.cs @@ -15,7 +15,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,9 +23,10 @@ namespace NzbDrone.Core.Indexers.Definitions { public override string Name => "TorrentSeeds"; - public override string BaseUrl => "https://torrentseeds.org/"; - private string LoginUrl => BaseUrl + "takelogin.php"; - private string TokenUrl => BaseUrl + "login.php"; + public override string[] IndexerUrls => new string[] { "https://torrentseeds.org/" }; + public override string Description => "TorrentSeeds is a Private site for MOVIES / TV / GENERAL"; + private string LoginUrl => Settings.BaseUrl + "takelogin.php"; + private string TokenUrl => Settings.BaseUrl + "login.php"; public override DownloadProtocol Protocol => DownloadProtocol.Torrent; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; public override IndexerCapabilities Capabilities => SetCapabilities(); @@ -38,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new TorrentSeedsRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new TorrentSeedsRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new TorrentSeedsParser(Settings, Capabilities.Categories, BaseUrl); + return new TorrentSeedsParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -186,7 +186,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public TorrentSeedsSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public TorrentSeedsRequestGenerator() { @@ -197,7 +196,7 @@ namespace NzbDrone.Core.Indexers.Definitions // remove operator characters var cleanSearchString = Regex.Replace(term.Trim(), "[ _.+-]+", " ", RegexOptions.Compiled); - var searchUrl = BaseUrl + "browse_elastic.php"; + var searchUrl = Settings.BaseUrl + "browse_elastic.php"; var queryCollection = new NameValueCollection { { "search_in", "name" }, @@ -276,13 +275,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly TorrentSeedsSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public TorrentSeedsParser(TorrentSeedsSettings settings, IndexerCapabilitiesCategories categories, string baseUrl) + public TorrentSeedsParser(TorrentSeedsSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -305,8 +302,8 @@ namespace NzbDrone.Core.Indexers.Definitions release.Title = qDetailsTitle.TextContent.Trim(); var qDlLink = row.QuerySelector("a[href^=\"/download.php?torrent=\"]"); - release.DownloadUrl = _baseUrl + qDlLink.GetAttribute("href").TrimStart('/'); - release.InfoUrl = _baseUrl + qDetailsLink.GetAttribute("href").TrimStart('/'); + release.DownloadUrl = _settings.BaseUrl + qDlLink.GetAttribute("href").TrimStart('/'); + release.InfoUrl = _settings.BaseUrl + qDetailsLink.GetAttribute("href").TrimStart('/'); release.Guid = release.InfoUrl; var qColumns = row.QuerySelectorAll("td"); @@ -344,7 +341,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class TorrentSeedsSettings : IProviderConfig + public class TorrentSeedsSettings : IIndexerSettings { private static readonly TorrentSeedsSettingsValidator Validator = new TorrentSeedsSettingsValidator(); @@ -354,10 +351,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(2, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", Type = FieldType.Password, HelpText = "Site Password", Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/Torznab/Torznab.cs b/src/NzbDrone.Core/Indexers/Definitions/Torznab/Torznab.cs index a90b1cb9a..ae6bb7886 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Torznab/Torznab.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Torznab/Torznab.cs @@ -19,7 +19,8 @@ namespace NzbDrone.Core.Indexers.Torznab private readonly INewznabCapabilitiesProvider _capabilitiesProvider; public override string Name => "Torznab"; - public override string BaseUrl => GetBaseUrlFromSettings(); + public override string[] IndexerUrls => GetBaseUrlFromSettings(); + public override string Description => ""; public override bool FollowRedirect => true; public override bool SupportsRedirect => true; @@ -43,16 +44,16 @@ namespace NzbDrone.Core.Indexers.Torznab return new TorznabRssParser(Settings); } - public string GetBaseUrlFromSettings() + public string[] GetBaseUrlFromSettings() { var baseUrl = ""; if (Definition == null || Settings == null || Settings.Categories == null) { - return baseUrl; + return new string[] { baseUrl }; } - return Settings.BaseUrl; + return new string[] { Settings.BaseUrl }; } public IndexerCapabilities GetCapabilitiesFromSettings() diff --git a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dBase.cs b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dBase.cs index 0d1f071a1..a96a6da84 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dBase.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D public abstract class Unit3dBase : TorrentIndexerBase { public override DownloadProtocol Protocol => DownloadProtocol.Torrent; - public override string BaseUrl => ""; + public override string[] IndexerUrls => new string[] { "" }; public override bool SupportsRss => true; public override bool SupportsSearch => true; public override int PageSize => 50; @@ -30,14 +30,13 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D Settings = Settings, HttpClient = _httpClient, Logger = _logger, - Capabilities = Capabilities, - BaseUrl = BaseUrl + Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new Unit3dParser(Capabilities.Categories, BaseUrl); + return new Unit3dParser(Settings, Capabilities.Categories); } protected virtual IndexerCapabilities SetCapabilities() diff --git a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs index ec6fabc05..7dcb82aaa 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs @@ -13,15 +13,15 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D { public class Unit3dParser : IParseIndexerResponse { - private readonly string _baseUrl; private readonly IndexerCapabilitiesCategories _categories; + private readonly Unit3dSettings _settings; - protected virtual string TorrentUrl => _baseUrl + "torrents"; + protected virtual string TorrentUrl => _settings.BaseUrl + "torrents"; - public Unit3dParser(IndexerCapabilitiesCategories categories, string baseUrl) + public Unit3dParser(Unit3dSettings settings, IndexerCapabilitiesCategories categories) { + _settings = settings; _categories = categories; - _baseUrl = baseUrl; } public Action, DateTime?> CookiesUpdater { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs index 070e722c1..4797a26f5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dRequestGenerator.cs @@ -11,13 +11,12 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D public class Unit3dRequestGenerator : IIndexerRequestGenerator { public Unit3dSettings Settings { get; set; } - public string BaseUrl { get; set; } public IHttpClient HttpClient { get; set; } public IndexerCapabilities Capabilities { get; set; } public Logger Logger { get; set; } - protected virtual string SearchUrl => BaseUrl + "api/torrents/filter"; + protected virtual string SearchUrl => Settings.BaseUrl + "api/torrents/filter"; protected virtual bool ImdbInTags => false; public Func> GetCookies { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dSettings.cs b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dSettings.cs index 75f6fb25e..7dbcd8d7d 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dSettings.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dSettings.cs @@ -1,6 +1,5 @@ using FluentValidation; using NzbDrone.Core.Annotations; -using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Definitions.UNIT3D @@ -13,7 +12,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D } } - public class Unit3dSettings : IProviderConfig + public class Unit3dSettings : IIndexerSettings { private static readonly Unit3dSettingsValidator Validator = new Unit3dSettingsValidator(); @@ -21,7 +20,10 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D { } - [FieldDefinition(1, Label = "Api Key", HelpText = "Api key generated in My Security", Privacy = PrivacyLevel.ApiKey)] + [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 = "Api Key", HelpText = "Api key generated in My Security", Privacy = PrivacyLevel.ApiKey)] public string ApiKey { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/Definitions/YTS.cs b/src/NzbDrone.Core/Indexers/Definitions/YTS.cs index e37d6354c..c78ca26f3 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/YTS.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/YTS.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; using System.Text; -using System.Threading.Tasks; using FluentValidation; using Newtonsoft.Json.Linq; using NLog; @@ -15,7 +14,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 @@ -23,7 +21,7 @@ namespace NzbDrone.Core.Indexers.Definitions public class YTS : TorrentIndexerBase { public override string Name => "YTS"; - public override string BaseUrl => "https://yts.mx/"; + public override string[] IndexerUrls => new string[] { "https://yts.mx/" }; public override string Language => "en-us"; public override string Description => "YTS is a Public torrent site specialising in HD movies of small size"; public override Encoding Encoding => Encoding.GetEncoding("windows-1252"); @@ -40,12 +38,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new YTSRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new YTSRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new YTSParser(Settings, Capabilities.Categories, BaseUrl); + return new YTSParser(Settings, Capabilities.Categories); } private IndexerCapabilities SetCapabilities() @@ -77,7 +75,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public YTSSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public YTSRequestGenerator() { @@ -85,7 +82,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories, string imdbId = null) { - var searchUrl = string.Format("{0}/api/v2/list_movies.json", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/api/v2/list_movies.json", Settings.BaseUrl.TrimEnd('/')); var searchString = term; @@ -160,13 +157,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly YTSSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public YTSParser(YTSSettings settings, IndexerCapabilitiesCategories categories, string baseurl) + public YTSParser(YTSSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseurl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -294,10 +289,13 @@ namespace NzbDrone.Core.Indexers.Definitions { } - public class YTSSettings : IProviderConfig + public class YTSSettings : IIndexerSettings { private static readonly YTSSettingsValidator Validator = new YTSSettingsValidator(); + [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; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs b/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs index 94b0262a5..826ab6bcc 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/ZonaQ.cs @@ -20,7 +20,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 @@ -28,11 +27,11 @@ namespace NzbDrone.Core.Indexers.Definitions public class ZonaQ : TorrentIndexerBase { public override string Name => "ZonaQ"; - public override string BaseUrl => "https://www.zonaq.pw/"; - private string Login1Url => BaseUrl + "index.php"; - private string Login2Url => BaseUrl + "paDentro.php"; - private string Login3Url => BaseUrl + "retorno/include/puerta_8_ajax.php"; - private string Login4Url => BaseUrl + "retorno/index.php"; + public override string[] IndexerUrls => new string[] { "https://www.zonaq.pw/" }; + private string Login1Url => Settings.BaseUrl + "index.php"; + private string Login2Url => Settings.BaseUrl + "paDentro.php"; + private string Login3Url => Settings.BaseUrl + "retorno/include/puerta_8_ajax.php"; + private string Login4Url => Settings.BaseUrl + "retorno/index.php"; public override string Description => "ZonaQ is a SPANISH Private Torrent Tracker for MOVIES / TV"; public override string Language => "es-es"; public override Encoding Encoding => Encoding.UTF8; @@ -47,12 +46,12 @@ namespace NzbDrone.Core.Indexers.Definitions public override IIndexerRequestGenerator GetRequestGenerator() { - return new ZonaQRequestGenerator() { Settings = Settings, Capabilities = Capabilities, BaseUrl = BaseUrl }; + return new ZonaQRequestGenerator() { Settings = Settings, Capabilities = Capabilities }; } public override IParseIndexerResponse GetParser() { - return new ZonaQParser(Settings, Capabilities.Categories, BaseUrl); + return new ZonaQParser(Settings, Capabilities.Categories); } protected override async Task DoLogin() @@ -236,7 +235,6 @@ namespace NzbDrone.Core.Indexers.Definitions { public ZonaQSettings Settings { get; set; } public IndexerCapabilities Capabilities { get; set; } - public string BaseUrl { get; set; } public ZonaQRequestGenerator() { @@ -244,7 +242,7 @@ namespace NzbDrone.Core.Indexers.Definitions private IEnumerable GetPagedRequests(string term, int[] categories) { - var searchUrl = string.Format("{0}/retorno/2/index.php", BaseUrl.TrimEnd('/')); + var searchUrl = string.Format("{0}/retorno/2/index.php", Settings.BaseUrl.TrimEnd('/')); var qc = new NameValueCollection { @@ -319,13 +317,11 @@ namespace NzbDrone.Core.Indexers.Definitions { private readonly ZonaQSettings _settings; private readonly IndexerCapabilitiesCategories _categories; - private readonly string _baseUrl; - public ZonaQParser(ZonaQSettings settings, IndexerCapabilitiesCategories categories, string baseurl) + public ZonaQParser(ZonaQSettings settings, IndexerCapabilitiesCategories categories) { _settings = settings; _categories = categories; - _baseUrl = baseurl; } public IList ParseResponse(IndexerResponse indexerResponse) @@ -409,7 +405,7 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class ZonaQSettings : IProviderConfig + public class ZonaQSettings : IIndexerSettings { private static readonly ZonaQSettingsValidator Validator = new ZonaQSettingsValidator(); @@ -419,10 +415,13 @@ namespace NzbDrone.Core.Indexers.Definitions Password = ""; } - [FieldDefinition(1, Label = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] + [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 = "Username", HelpText = "Site Username", Type = FieldType.Textbox, Privacy = PrivacyLevel.UserName)] public string Username { get; set; } - [FieldDefinition(1, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] + [FieldDefinition(3, Label = "Password", HelpText = "Site Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)] public string Password { get; set; } public NzbDroneValidationResult Validate() diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 99e0bdedd..f0e09efb5 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -20,7 +20,7 @@ using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { public abstract class HttpIndexerBase : IndexerBase - where TSettings : IProviderConfig, new() + where TSettings : IIndexerSettings, new() { protected const int MaxNumResultsPerQuery = 1000; @@ -35,9 +35,6 @@ namespace NzbDrone.Core.Indexers public override Encoding Encoding => Encoding.UTF8; public override string Language => "en-US"; - //TODO Remove this once we catch up on individual indexers - public override string Description => ""; - public override bool FollowRedirect => false; public override IndexerCapabilities Capabilities { get; protected set; } public virtual int PageSize => 0; diff --git a/src/NzbDrone.Core/Indexers/IIndexer.cs b/src/NzbDrone.Core/Indexers/IIndexer.cs index aa7c5d9c0..4b4a7b783 100644 --- a/src/NzbDrone.Core/Indexers/IIndexer.cs +++ b/src/NzbDrone.Core/Indexers/IIndexer.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Indexers bool SupportsRedirect { get; } IndexerCapabilities Capabilities { get; } - string BaseUrl { get; } + string[] IndexerUrls { get; } string Description { get; } Encoding Encoding { get; } string Language { get; } diff --git a/src/NzbDrone.Core/Indexers/IIndexerSettings.cs b/src/NzbDrone.Core/Indexers/IIndexerSettings.cs new file mode 100644 index 000000000..732b1b873 --- /dev/null +++ b/src/NzbDrone.Core/Indexers/IIndexerSettings.cs @@ -0,0 +1,9 @@ +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Indexers +{ + public interface IIndexerSettings : IProviderConfig + { + string BaseUrl { get; set; } + } +} diff --git a/src/NzbDrone.Core/Indexers/IndexerBase.cs b/src/NzbDrone.Core/Indexers/IndexerBase.cs index f2f0b6ca7..7cec8fddc 100644 --- a/src/NzbDrone.Core/Indexers/IndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/IndexerBase.cs @@ -14,14 +14,14 @@ using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { public abstract class IndexerBase : 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 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 Fetch(MovieSearchCriteria searchCriteria); public abstract Task 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(); diff --git a/src/NzbDrone.Core/Indexers/IndexerDefinition.cs b/src/NzbDrone.Core/Indexers/IndexerDefinition.cs index fc8dd0c6f..597ac0d2e 100644 --- a/src/NzbDrone.Core/Indexers/IndexerDefinition.cs +++ b/src/NzbDrone.Core/Indexers/IndexerDefinition.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers { public class IndexerDefinition : ProviderDefinition { - public string BaseUrl { get; set; } + public string[] IndexerUrls { get; set; } public string Description { get; set; } public Encoding Encoding { get; set; } public string Language { get; set; } diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs index bf5aaa99c..b93d79147 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -90,7 +90,7 @@ namespace NzbDrone.Core.Indexers }); } - definition.BaseUrl = defFile.Links.First(); + definition.IndexerUrls = defFile.Links.ToArray(); definition.Description = defFile.Description; definition.Language = defFile.Language; definition.Encoding = Encoding.GetEncoding(defFile.Encoding); @@ -174,7 +174,7 @@ namespace NzbDrone.Core.Indexers //We want to use the definition Caps and Privacy for Cardigann instead of the provider. if (definition.Implementation != typeof(Cardigann.Cardigann).Name) { - definition.BaseUrl = provider.BaseUrl; + definition.IndexerUrls = provider.IndexerUrls; definition.Privacy = provider.Privacy; definition.Description = provider.Description; definition.Encoding = provider.Encoding; diff --git a/src/NzbDrone.Core/Indexers/IndexerFlag.cs b/src/NzbDrone.Core/Indexers/IndexerFlag.cs index abcf5862f..340a343f2 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFlag.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFlag.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace NzbDrone.Core.Indexers { diff --git a/src/NzbDrone.Core/Indexers/TorrentIndexerBase.cs b/src/NzbDrone.Core/Indexers/TorrentIndexerBase.cs index 5f61c2d18..510eab655 100644 --- a/src/NzbDrone.Core/Indexers/TorrentIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/TorrentIndexerBase.cs @@ -8,12 +8,11 @@ using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Exceptions; using NzbDrone.Core.Messaging.Events; -using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { public abstract class TorrentIndexerBase : HttpIndexerBase - where TSettings : IProviderConfig, new() + where TSettings : IIndexerSettings, new() { protected TorrentIndexerBase(IHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) : base(httpClient, eventAggregator, indexerStatusService, configService, logger) diff --git a/src/NzbDrone.Core/Indexers/UsenetIndexerBase.cs b/src/NzbDrone.Core/Indexers/UsenetIndexerBase.cs index 3622d55c7..42d8e20b4 100644 --- a/src/NzbDrone.Core/Indexers/UsenetIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/UsenetIndexerBase.cs @@ -7,12 +7,11 @@ using NzbDrone.Core.Configuration; using NzbDrone.Core.Download; using NzbDrone.Core.Exceptions; using NzbDrone.Core.Messaging.Events; -using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { public abstract class UsenetIndexerBase : HttpIndexerBase - where TSettings : IProviderConfig, new() + where TSettings : IIndexerSettings, new() { private readonly IValidateNzbs _nzbValidationService; diff --git a/src/NzbDrone.Core/Profiles/AppSyncProfileRepository.cs b/src/NzbDrone.Core/Profiles/AppSyncProfileRepository.cs index 9e2f87f09..0acf74f7b 100644 --- a/src/NzbDrone.Core/Profiles/AppSyncProfileRepository.cs +++ b/src/NzbDrone.Core/Profiles/AppSyncProfileRepository.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; using NzbDrone.Core.Datastore; using NzbDrone.Core.Messaging.Events; diff --git a/src/NzbDrone.Core/Update/History/UpdateHistoryRepository.cs b/src/NzbDrone.Core/Update/History/UpdateHistoryRepository.cs index 40bd68963..fe5e259b5 100644 --- a/src/NzbDrone.Core/Update/History/UpdateHistoryRepository.cs +++ b/src/NzbDrone.Core/Update/History/UpdateHistoryRepository.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using NzbDrone.Core.Datastore; using NzbDrone.Core.Messaging.Events; diff --git a/src/NzbDrone.Core/Update/RecentUpdateProvider.cs b/src/NzbDrone.Core/Update/RecentUpdateProvider.cs index 42b338f5f..4796a68e2 100644 --- a/src/NzbDrone.Core/Update/RecentUpdateProvider.cs +++ b/src/NzbDrone.Core/Update/RecentUpdateProvider.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; using NzbDrone.Core.Update.History; diff --git a/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs b/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs index 5b93209cb..fc69ef06d 100644 --- a/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs +++ b/src/Prowlarr.Api.V1/Indexers/IndexerResource.cs @@ -14,7 +14,7 @@ namespace Prowlarr.Api.V1.Indexers { public class IndexerResource : ProviderResource { - public string BaseUrl { get; set; } + public string[] IndexerUrls { get; set; } public string Description { get; set; } public string Language { get; set; } public string Encoding { get; set; } @@ -74,7 +74,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.BaseUrl = definition.BaseUrl; + resource.IndexerUrls = definition.IndexerUrls; resource.Description = definition.Description; resource.Language = definition.Language; resource.Encoding = definition.Encoding?.EncodingName ?? null; @@ -130,7 +130,7 @@ namespace Prowlarr.Api.V1.Indexers definition.AppProfileId = resource.AppProfileId; definition.Enable = resource.Enable; definition.Redirect = resource.Redirect; - definition.BaseUrl = resource.BaseUrl; + definition.IndexerUrls = resource.IndexerUrls; definition.Priority = resource.Priority; definition.Privacy = resource.Privacy; definition.Added = resource.Added;