diff --git a/src/NzbDrone.Core.Test/IndexerTests/IPTorrentsTests/IPTorrentsFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/IPTorrentsTests/IPTorrentsFixture.cs index d48c06f6c..7b5b4fc1a 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/IPTorrentsTests/IPTorrentsFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IPTorrentsTests/IPTorrentsFixture.cs @@ -20,7 +20,7 @@ public void Setup() Subject.Definition = new IndexerDefinition() { Name = "IPTorrents", - Settings = new IPTorrentsSettings() { Url = "http://fake.com/" } + Settings = new IPTorrentsSettings() { BaseUrl = "http://fake.com/" } }; } diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabCapabilitiesProviderFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabCapabilitiesProviderFixture.cs index e3a0e053c..f75ceab36 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabCapabilitiesProviderFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabCapabilitiesProviderFixture.cs @@ -21,7 +21,7 @@ public void SetUp() { _settings = new NewznabSettings() { - Url = "http://indxer.local" + BaseUrl = "http://indxer.local" }; _caps = ReadAllText("Files/Indexers/Newznab/newznab_caps.xml"); diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs index d5dd2cfb7..7f92e6637 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabFixture.cs @@ -26,7 +26,7 @@ public void Setup() Name = "Newznab", Settings = new NewznabSettings() { - Url = "http://indexer.local/", + BaseUrl = "http://indexer.local/", Categories = new int[] { 1 } } }; diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs index 98de0e652..c32c888e1 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabRequestGeneratorFixture.cs @@ -20,10 +20,10 @@ public void SetUp() { Subject.Settings = new NewznabSettings() { - Url = "http://127.0.0.1:1234/", - Categories = new [] { 1, 2 }, - AnimeCategories = new [] { 3, 4 }, - ApiKey = "abcd", + BaseUrl = "http://127.0.0.1:1234/", + Categories = new [] { 1, 2 }, + AnimeCategories = new [] { 3, 4 }, + ApiKey = "abcd", }; _singleEpisodeSearchCriteria = new SingleEpisodeSearchCriteria @@ -84,7 +84,7 @@ public void should_use_only_anime_categories_for_anime_search() page.Url.FullUri.Should().Contain("&cat=3,4&"); } - + [Test] public void should_use_mode_search_for_anime() { diff --git a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabSettingFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabSettingFixture.cs index 4bd26817d..21da9fa64 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabSettingFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/NewznabTests/NewznabSettingFixture.cs @@ -15,12 +15,12 @@ public void requires_apikey(string url) var setting = new NewznabSettings() { ApiKey = "", - Url = url + BaseUrl = url }; setting.Validate().IsValid.Should().BeFalse(); - setting.Validate().Errors.Should().Contain(c => c.PropertyName == "ApiKey"); + setting.Validate().Errors.Should().Contain(c => c.PropertyName == nameof(NewznabSettings.ApiKey)); } @@ -32,13 +32,13 @@ public void invalid_url_should_not_apikey(string url) var setting = new NewznabSettings { ApiKey = "", - Url = url + BaseUrl = url }; setting.Validate().IsValid.Should().BeFalse(); - setting.Validate().Errors.Should().NotContain(c => c.PropertyName == "ApiKey"); - setting.Validate().Errors.Should().Contain(c => c.PropertyName == "Url"); + setting.Validate().Errors.Should().NotContain(c => c.PropertyName == nameof(NewznabSettings.ApiKey)); + setting.Validate().Errors.Should().Contain(c => c.PropertyName == nameof(NewznabSettings.BaseUrl)); } @@ -49,11 +49,11 @@ public void doesnt_requires_apikey(string url) var setting = new NewznabSettings() { ApiKey = "", - Url = url + BaseUrl = url }; setting.Validate().IsValid.Should().BeTrue(); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs b/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs index 3006c6b36..1fcff3220 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs @@ -1,14 +1,17 @@ using System; +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() { throw new NotImplementedException(); } + + public string BaseUrl { get; set; } } } diff --git a/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs index 8701fdc9a..e5467d4ab 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TorznabTests/TorznabFixture.cs @@ -25,7 +25,7 @@ public void Setup() Name = "Torznab", Settings = new TorznabSettings() { - Url = "http://indexer.local/", + BaseUrl = "http://indexer.local/", Categories = new int[] { 1 } } }; @@ -44,7 +44,7 @@ public void should_parse_recent_feed_from_torznab_hdaccess_net() Mocker.GetMock() .Setup(o => o.Execute(It.Is(v => v.Method == HttpMethod.GET))) .Returns(r => new HttpResponse(r, new HttpHeader(), recentFeed)); - + var releases = Subject.FetchRecent(); releases.Should().HaveCount(5); diff --git a/src/NzbDrone.Core/Datastore/Migration/113_consolidate_indexer_baseurl.cs b/src/NzbDrone.Core/Datastore/Migration/113_consolidate_indexer_baseurl.cs new file mode 100644 index 000000000..3c67405bd --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/113_consolidate_indexer_baseurl.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Data; +using FluentMigrator; +using Newtonsoft.Json.Linq; +using NzbDrone.Common.Extensions; +using NzbDrone.Common.Serializer; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(113)] + public class consolidate_indexer_baseurl : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Execute.WithConnection(RenameUrlToBaseUrl); + } + + private void RenameUrlToBaseUrl(IDbConnection conn, IDbTransaction tran) + { + using (var cmd = conn.CreateCommand()) + { + cmd.Transaction = tran; + cmd.CommandText = "SELECT Id, Settings FROM Indexers WHERE ConfigContract IN ('NewznabSettings', 'TorznabSettings', 'IPTorrentsSettings', 'OmgwtfnzbsSettings')"; + + using (var reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + var id = reader.GetInt32(0); + var settings = reader.GetString(1); + + if (settings.IsNotNullOrWhiteSpace()) + { + var jsonObject = Json.Deserialize(settings); + + if (jsonObject.Property("url") != null) + { + jsonObject.AddFirst(new JProperty("baseUrl", jsonObject["url"])); + jsonObject.Remove("url"); + settings = jsonObject.ToJson(); + + using (var updateCmd = conn.CreateCommand()) + { + updateCmd.Transaction = tran; + updateCmd.CommandText = "UPDATE Indexers SET Settings = ? WHERE Id = ?"; + updateCmd.AddParameter(settings); + updateCmd.AddParameter(id); + updateCmd.ExecuteNonQuery(); + } + } + } + } + } + } + } + } +} diff --git a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs index 6e48f46de..843dac050 100644 --- a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs +++ b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs @@ -23,7 +23,7 @@ public BitMeTvSettingsValidator() } } - public class BitMeTvSettings : IProviderConfig + public class BitMeTvSettings : IIndexerSettings { private static readonly BitMeTvSettingsValidator Validator = new BitMeTvSettingsValidator(); @@ -49,4 +49,4 @@ public NzbDroneValidationResult Validate() return new NzbDroneValidationResult(Validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs index 620ce9887..1c3f8ae13 100644 --- a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs +++ b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs @@ -14,7 +14,7 @@ public BroadcastheNetSettingsValidator() } } - public class BroadcastheNetSettings : IProviderConfig + public class BroadcastheNetSettings : IIndexerSettings { private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator(); diff --git a/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs b/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs index 1f9f25028..fd07365fd 100644 --- a/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs +++ b/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs @@ -13,7 +13,7 @@ public FanzubSettingsValidator() } } - public class FanzubSettings : IProviderConfig + public class FanzubSettings : IIndexerSettings { private static readonly FanzubSettingsValidator Validator = new FanzubSettingsValidator(); diff --git a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs index 933a134d2..802b5e7d1 100644 --- a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs +++ b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs @@ -14,7 +14,7 @@ public HDBitsSettingsValidator() } } - public class HDBitsSettings : IProviderConfig + public class HDBitsSettings : IIndexerSettings { private static readonly HDBitsSettingsValidator Validator = new HDBitsSettingsValidator(); diff --git a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs index 75ad1354e..973afe6b1 100644 --- a/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/HttpIndexerBase.cs @@ -17,7 +17,7 @@ namespace NzbDrone.Core.Indexers { public abstract class HttpIndexerBase : IndexerBase - where TSettings : IProviderConfig, new() + where TSettings : IIndexerSettings, new() { protected const int MaxNumResultsPerQuery = 1000; diff --git a/src/NzbDrone.Core/Indexers/IIndexerSettings.cs b/src/NzbDrone.Core/Indexers/IIndexerSettings.cs new file mode 100644 index 000000000..85731eb23 --- /dev/null +++ b/src/NzbDrone.Core/Indexers/IIndexerSettings.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Indexers +{ + public interface IIndexerSettings : IProviderConfig + { + string BaseUrl { get; set; } + } +} diff --git a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsRequestGenerator.cs b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsRequestGenerator.cs index bf4d9e7b8..045291858 100644 --- a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsRequestGenerator.cs @@ -7,7 +7,7 @@ namespace NzbDrone.Core.Indexers.IPTorrents public class IPTorrentsRequestGenerator : IIndexerRequestGenerator { public IPTorrentsSettings Settings { get; set; } - + public virtual IndexerPageableRequestChain GetRecentRequests() { var pageableRequests = new IndexerPageableRequestChain(); @@ -44,7 +44,7 @@ public virtual IndexerPageableRequestChain GetSearchRequests(SpecialEpisodeSearc private IEnumerable GetRssRequests() { - yield return new IndexerRequest(Settings.Url, HttpAccept.Rss); + yield return new IndexerRequest(Settings.BaseUrl, HttpAccept.Rss); } } } diff --git a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs index 4b82353a2..e3e7993d8 100644 --- a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs +++ b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs @@ -11,17 +11,17 @@ public class IPTorrentsSettingsValidator : AbstractValidator { public IPTorrentsSettingsValidator() { - RuleFor(c => c.Url).ValidRootUrl(); + RuleFor(c => c.BaseUrl).ValidRootUrl(); - RuleFor(c => c.Url).Matches(@"/rss\?.+$"); + RuleFor(c => c.BaseUrl).Matches(@"/rss\?.+$"); - RuleFor(c => c.Url).Matches(@"/rss\?.+;download(?:;|$)") + RuleFor(c => c.BaseUrl).Matches(@"/rss\?.+;download(?:;|$)") .WithMessage("Use Direct Download Url (;download)") - .When(v => v.Url.IsNotNullOrWhiteSpace() && Regex.IsMatch(v.Url, @"/rss\?.+$")); + .When(v => v.BaseUrl.IsNotNullOrWhiteSpace() && Regex.IsMatch(v.BaseUrl, @"/rss\?.+$")); } } - public class IPTorrentsSettings : IProviderConfig + public class IPTorrentsSettings : IIndexerSettings { private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator(); @@ -30,7 +30,7 @@ public IPTorrentsSettings() } [FieldDefinition(0, Label = "Feed URL", HelpText = "The full RSS feed url generated by IPTorrents, using only the categories you selected (HD, SD, x264, etc ...)")] - public string Url { get; set; } + public string BaseUrl { get; set; } public NzbDroneValidationResult Validate() { diff --git a/src/NzbDrone.Core/Indexers/IndexerBase.cs b/src/NzbDrone.Core/Indexers/IndexerBase.cs index 4e08e5aad..8d8419095 100644 --- a/src/NzbDrone.Core/Indexers/IndexerBase.cs +++ b/src/NzbDrone.Core/Indexers/IndexerBase.cs @@ -13,7 +13,7 @@ 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; diff --git a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs index 4258670dd..73a49735f 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -78,7 +78,7 @@ private IndexerDefinition GetDefinition(string name, NewznabSettings settings) private NewznabSettings GetSettings(string url, params int[] categories) { - var settings = new NewznabSettings { Url = url }; + var settings = new NewznabSettings { BaseUrl = url }; if (categories.Any()) { diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs index 6e870ec3d..cb883b851 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabCapabilitiesProvider.cs @@ -41,7 +41,7 @@ private NewznabCapabilities FetchCapabilities(NewznabSettings indexerSettings) { var capabilities = new NewznabCapabilities(); - var url = string.Format("{0}/api?t=caps", indexerSettings.Url.TrimEnd('/')); + var url = string.Format("{0}/api?t=caps", indexerSettings.BaseUrl.TrimEnd('/')); if (indexerSettings.ApiKey.IsNotNullOrWhiteSpace()) { @@ -58,7 +58,7 @@ private NewznabCapabilities FetchCapabilities(NewznabSettings indexerSettings) } catch (Exception ex) { - _logger.Debug(ex, "Failed to get newznab api capabilities from {0}", indexerSettings.Url); + _logger.Debug(ex, "Failed to get newznab api capabilities from {0}", indexerSettings.BaseUrl); throw; } @@ -68,14 +68,14 @@ private NewznabCapabilities FetchCapabilities(NewznabSettings indexerSettings) } catch (XmlException ex) { - _logger.Debug(ex, "Failed to parse newznab api capabilities for {0}.", indexerSettings.Url); + _logger.Debug(ex, "Failed to parse newznab api capabilities for {0}.", indexerSettings.BaseUrl); ex.WithData(response); throw; } catch (Exception ex) { - _logger.Error(ex, "Failed to determine newznab api capabilities for {0}, using the defaults instead till Sonarr restarts.", indexerSettings.Url); + _logger.Error(ex, "Failed to determine newznab api capabilities for {0}, using the defaults instead till Sonarr restarts.", indexerSettings.BaseUrl); } return capabilities; diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs index 915603c15..450027233 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs @@ -249,7 +249,7 @@ private IEnumerable GetPagedRequests(int maxPages, IEnumerable private static bool ShouldHaveApiKey(NewznabSettings settings) { - if (settings.Url == null) + if (settings.BaseUrl == null) { return false; } - return ApiKeyWhiteList.Any(c => settings.Url.ToLowerInvariant().Contains(c)); + return ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c)); } private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled); @@ -47,14 +47,14 @@ public NewznabSettingsValidator() return null; }); - RuleFor(c => c.Url).ValidRootUrl(); + RuleFor(c => c.BaseUrl).ValidRootUrl(); RuleFor(c => c.ApiKey).NotEmpty().When(ShouldHaveApiKey); RuleFor(c => c.AdditionalParameters).Matches(AdditionalParametersRegex) .When(c => !c.AdditionalParameters.IsNullOrWhiteSpace()); } } - public class NewznabSettings : IProviderConfig + public class NewznabSettings : IIndexerSettings { private static readonly NewznabSettingsValidator Validator = new NewznabSettingsValidator(); @@ -65,7 +65,7 @@ public NewznabSettings() } [FieldDefinition(0, Label = "URL")] - public string Url { get; set; } + public string BaseUrl { get; set; } [FieldDefinition(1, Label = "API Key")] public string ApiKey { get; set; } @@ -84,4 +84,4 @@ public virtual NzbDroneValidationResult Validate() return new NzbDroneValidationResult(Validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs index 5977c2782..83ef2c60a 100644 --- a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs +++ b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs @@ -14,7 +14,7 @@ public NyaaSettingsValidator() } } - public class NyaaSettings : IProviderConfig + public class NyaaSettings : IIndexerSettings { private static readonly NyaaSettingsValidator Validator = new NyaaSettingsValidator(); @@ -35,4 +35,4 @@ public NzbDroneValidationResult Validate() return new NzbDroneValidationResult(Validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs index fe6217361..5f5fed9b1 100644 --- a/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs +++ b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs @@ -15,7 +15,7 @@ public OmgwtfnzbsSettingsValidator() } } - public class OmgwtfnzbsSettings : IProviderConfig + public class OmgwtfnzbsSettings : IIndexerSettings { private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator(); @@ -24,6 +24,9 @@ public OmgwtfnzbsSettings() Delay = 30; } + // Unused since Omg has a hardcoded url. + public string BaseUrl { get; set; } + [FieldDefinition(0, Label = "Username")] public string Username { get; set; } diff --git a/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs b/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs index c60616b27..c4888b307 100644 --- a/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs +++ b/src/NzbDrone.Core/Indexers/Rarbg/RarbgSettings.cs @@ -13,7 +13,7 @@ public RarbgSettingsValidator() } } - public class RarbgSettings : IProviderConfig + public class RarbgSettings : IIndexerSettings { private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator(); @@ -28,7 +28,7 @@ public RarbgSettings() [FieldDefinition(1, 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.")] public string CaptchaToken { get; set; } @@ -37,4 +37,4 @@ public NzbDroneValidationResult Validate() return new NzbDroneValidationResult(Validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs b/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs index ef2b74f9a..57606af46 100644 --- a/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs +++ b/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs @@ -13,7 +13,7 @@ public TorrentRssIndexerSettingsValidator() } } - public class TorrentRssIndexerSettings : IProviderConfig + public class TorrentRssIndexerSettings : IIndexerSettings { private static readonly TorrentRssIndexerSettingsValidator validator = new TorrentRssIndexerSettingsValidator(); @@ -37,4 +37,4 @@ public NzbDroneValidationResult Validate() return new NzbDroneValidationResult(validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs b/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs index 957bfc3ed..18392c520 100644 --- a/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs +++ b/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs @@ -14,7 +14,7 @@ public TorrentleechSettingsValidator() } } - public class TorrentleechSettings : IProviderConfig + public class TorrentleechSettings : IIndexerSettings { private static readonly TorrentleechSettingsValidator Validator = new TorrentleechSettingsValidator(); @@ -34,4 +34,4 @@ public NzbDroneValidationResult Validate() return new NzbDroneValidationResult(Validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs b/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs index 8d2649c2d..5027cf6f8 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs @@ -66,7 +66,7 @@ private IndexerDefinition GetDefinition(string name, TorznabSettings settings) private TorznabSettings GetSettings(string url, params int[] categories) { - var settings = new TorznabSettings { Url = url }; + var settings = new TorznabSettings { BaseUrl = url }; if (categories.Any()) { diff --git a/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs b/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs index 86d7be1a1..9a328d6b6 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs @@ -17,12 +17,12 @@ public class TorznabSettingsValidator : AbstractValidator private static bool ShouldHaveApiKey(TorznabSettings settings) { - if (settings.Url == null) + if (settings.BaseUrl == null) { return false; } - return ApiKeyWhiteList.Any(c => settings.Url.ToLowerInvariant().Contains(c)); + return ApiKeyWhiteList.Any(c => settings.BaseUrl.ToLowerInvariant().Contains(c)); } private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled); @@ -39,7 +39,7 @@ public TorznabSettingsValidator() return null; }); - RuleFor(c => c.Url).ValidRootUrl(); + RuleFor(c => c.BaseUrl).ValidRootUrl(); RuleFor(c => c.ApiKey).NotEmpty().When(ShouldHaveApiKey); RuleFor(c => c.AdditionalParameters).Matches(AdditionalParametersRegex) .When(c => !c.AdditionalParameters.IsNullOrWhiteSpace()); @@ -55,4 +55,4 @@ public override NzbDroneValidationResult Validate() return new NzbDroneValidationResult(Validator.Validate(this)); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 29b2dcc0e..cd9d2f262 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -250,6 +250,7 @@ + @@ -628,6 +629,7 @@ +