Fixes #1809 Fixes #1102 Closes #2169pull/2168/head^2
parent
8bd7194121
commit
9cec9ac428
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.Indexers;
|
|
||||||
using NzbDrone.Core.Indexers.Omgwtfnzbs;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.IndexerTests.OmgwtfnzbsTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class OmgwtfnzbsFixture : CoreTest<Omgwtfnzbs>
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
Subject.Definition = new IndexerDefinition()
|
|
||||||
{
|
|
||||||
Name = "Omgwtfnzbs",
|
|
||||||
Settings = new OmgwtfnzbsSettings()
|
|
||||||
{
|
|
||||||
ApiKey = "xxx",
|
|
||||||
Username = "me@my.domain"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_parse_recent_feed_from_omgwtfnzbs()
|
|
||||||
{
|
|
||||||
var recentFeed = ReadAllText(@"Files/Indexers/Omgwtfnzbs/Omgwtfnzbs.xml");
|
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
|
||||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get)))
|
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
|
||||||
|
|
||||||
var releases = Subject.FetchRecent();
|
|
||||||
|
|
||||||
releases.Should().HaveCount(100);
|
|
||||||
|
|
||||||
var releaseInfo = releases.First();
|
|
||||||
|
|
||||||
releaseInfo.Title.Should().Be("Stephen.Fry.Gadget.Man.S01E05.HDTV.x264-C4TV");
|
|
||||||
releaseInfo.DownloadProtocol.Should().Be(DownloadProtocol.Usenet);
|
|
||||||
releaseInfo.DownloadUrl.Should().Be("http://api.omgwtfnzbs.org/sn.php?id=OAl4g&user=nzbdrone&api=nzbdrone");
|
|
||||||
releaseInfo.InfoUrl.Should().Be("http://omgwtfnzbs.org/details.php?id=OAl4g");
|
|
||||||
releaseInfo.CommentUrl.Should().BeNullOrEmpty();
|
|
||||||
releaseInfo.Indexer.Should().Be(Subject.Definition.Name);
|
|
||||||
releaseInfo.PublishDate.Should().Be(DateTime.Parse("2012/12/17 23:30:13"));
|
|
||||||
releaseInfo.Size.Should().Be(236822906);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.Indexers;
|
|
||||||
using NzbDrone.Core.Indexers.Rarbg;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
using NzbDrone.Core.Test.Framework;
|
|
||||||
using NzbDrone.Test.Common;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.IndexerTests.RarbgTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class RarbgFixture : CoreTest<Rarbg>
|
|
||||||
{
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
Subject.Definition = new IndexerDefinition()
|
|
||||||
{
|
|
||||||
Name = "Rarbg",
|
|
||||||
Settings = new RarbgSettings()
|
|
||||||
};
|
|
||||||
|
|
||||||
Mocker.GetMock<IRarbgTokenProvider>()
|
|
||||||
.Setup(v => v.GetToken(It.IsAny<RarbgSettings>()))
|
|
||||||
.Returns("validtoken");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_parse_recent_feed_from_Rarbg()
|
|
||||||
{
|
|
||||||
var recentFeed = ReadAllText(@"Files/Indexers/Rarbg/RecentFeed_v2.json");
|
|
||||||
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
|
||||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get)))
|
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), recentFeed));
|
|
||||||
|
|
||||||
var releases = Subject.FetchRecent();
|
|
||||||
|
|
||||||
releases.Should().HaveCount(4);
|
|
||||||
releases.First().Should().BeOfType<TorrentInfo>();
|
|
||||||
|
|
||||||
var torrentInfo = releases.First() as TorrentInfo;
|
|
||||||
|
|
||||||
torrentInfo.Title.Should().Be("Sense8.S01E01.WEBRip.x264-FGT");
|
|
||||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
|
||||||
torrentInfo.DownloadUrl.Should().Be("magnet:?xt=urn:btih:d8bde635f573acb390c7d7e7efc1556965fdc802&dn=Sense8.S01E01.WEBRip.x264-FGT&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce");
|
|
||||||
torrentInfo.InfoUrl.Should().Be("https://torrentapi.org/redirect_to_info.php?token=i5cx7b9agd&p=8_6_4_4_5_6__d8bde635f5&app_id=Readarr");
|
|
||||||
torrentInfo.Indexer.Should().Be(Subject.Definition.Name);
|
|
||||||
torrentInfo.PublishDate.Should().Be(DateTime.Parse("2015-06-05 16:58:11 +0000").ToUniversalTime());
|
|
||||||
torrentInfo.Size.Should().Be(564198371);
|
|
||||||
torrentInfo.InfoHash.Should().BeNull();
|
|
||||||
torrentInfo.MagnetUrl.Should().BeNull();
|
|
||||||
torrentInfo.Peers.Should().Be(304 + 200);
|
|
||||||
torrentInfo.Seeders.Should().Be(304);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_parse_error_20_as_empty_results()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
|
||||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get)))
|
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), "{ error_code: 20, error: \"some message\" }"));
|
|
||||||
|
|
||||||
var releases = Subject.FetchRecent();
|
|
||||||
|
|
||||||
releases.Should().HaveCount(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_warn_on_unknown_error()
|
|
||||||
{
|
|
||||||
Mocker.GetMock<IHttpClient>()
|
|
||||||
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get)))
|
|
||||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), "{ error_code: 25, error: \"some message\" }"));
|
|
||||||
|
|
||||||
var releases = Subject.FetchRecent();
|
|
||||||
|
|
||||||
releases.Should().HaveCount(0);
|
|
||||||
|
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,15 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(027)]
|
||||||
|
public class remove_omg : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Execute.Sql("DELETE FROM Indexers WHERE Implementation = 'Omgwtfnzbs'");
|
||||||
|
Execute.Sql("DELETE FROM Indexers WHERE Implementation = 'Rarbg'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,65 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using NzbDrone.Common.Extensions;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
|
||||||
{
|
|
||||||
public class OmgwtfnzbsRequestGenerator : IIndexerRequestGenerator
|
|
||||||
{
|
|
||||||
public string BaseUrl { get; set; }
|
|
||||||
public OmgwtfnzbsSettings Settings { get; set; }
|
|
||||||
|
|
||||||
public OmgwtfnzbsRequestGenerator()
|
|
||||||
{
|
|
||||||
BaseUrl = "https://rss.omgwtfnzbs.me/rss-download.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(null));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}+{1}",
|
|
||||||
searchCriteria.AuthorQuery,
|
|
||||||
searchCriteria.BookQuery)));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(AuthorSearchCriteria searchCriteria)
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests(string.Format("{0}",
|
|
||||||
searchCriteria.AuthorQuery)));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(string query)
|
|
||||||
{
|
|
||||||
var url = new StringBuilder();
|
|
||||||
|
|
||||||
// Category 22 is Music-FLAC, category 7 is Music-MP3
|
|
||||||
url.AppendFormat("{0}?catid=22,7&user={1}&api={2}&eng=1&delay={3}", BaseUrl, Settings.Username, Settings.ApiKey, Settings.Delay);
|
|
||||||
|
|
||||||
if (query.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
url = url.Replace("rss-download.php", "rss-search.php");
|
|
||||||
url.AppendFormat("&search={0}", query);
|
|
||||||
}
|
|
||||||
|
|
||||||
yield return new IndexerRequest(url.ToString(), HttpAccept.Rss);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
using FluentValidation;
|
|
||||||
using NzbDrone.Core.Annotations;
|
|
||||||
using NzbDrone.Core.Validation;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
|
|
||||||
{
|
|
||||||
public class OmgwtfnzbsSettingsValidator : AbstractValidator<OmgwtfnzbsSettings>
|
|
||||||
{
|
|
||||||
public OmgwtfnzbsSettingsValidator()
|
|
||||||
{
|
|
||||||
RuleFor(c => c.Username).NotEmpty();
|
|
||||||
RuleFor(c => c.ApiKey).NotEmpty();
|
|
||||||
RuleFor(c => c.Delay).GreaterThanOrEqualTo(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OmgwtfnzbsSettings : IIndexerSettings
|
|
||||||
{
|
|
||||||
private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator();
|
|
||||||
|
|
||||||
public OmgwtfnzbsSettings()
|
|
||||||
{
|
|
||||||
Delay = 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unused since Omg has a hardcoded url.
|
|
||||||
public string BaseUrl { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
|
||||||
public string Username { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "API Key", Privacy = PrivacyLevel.ApiKey)]
|
|
||||||
public string ApiKey { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "Delay", HelpText = "Time in minutes to delay new nzbs before they appear on the RSS feed", Advanced = true)]
|
|
||||||
public int Delay { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(3, Type = FieldType.Number, Label = "Early Download Limit", Unit = "days", HelpText = "Time before release date Readarr will download from this indexer, empty is no limit", Advanced = true)]
|
|
||||||
public int? EarlyReleaseLimit { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using NLog;
|
|
||||||
using NzbDrone.Common.Extensions;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.Configuration;
|
|
||||||
using NzbDrone.Core.Exceptions;
|
|
||||||
using NzbDrone.Core.Http.CloudFlare;
|
|
||||||
using NzbDrone.Core.Parser;
|
|
||||||
using NzbDrone.Core.Validation;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Rarbg
|
|
||||||
{
|
|
||||||
public class Rarbg : HttpIndexerBase<RarbgSettings>
|
|
||||||
{
|
|
||||||
private readonly IRarbgTokenProvider _tokenProvider;
|
|
||||||
|
|
||||||
public override string Name => "Rarbg";
|
|
||||||
|
|
||||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
|
||||||
|
|
||||||
public override TimeSpan RateLimit => TimeSpan.FromSeconds(2);
|
|
||||||
|
|
||||||
public Rarbg(IRarbgTokenProvider tokenProvider, IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
|
||||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
|
||||||
{
|
|
||||||
_tokenProvider = tokenProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
|
||||||
{
|
|
||||||
return new RarbgRequestGenerator(_tokenProvider) { Settings = Settings };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IParseIndexerResponse GetParser()
|
|
||||||
{
|
|
||||||
return new RarbgParser();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object RequestAction(string action, IDictionary<string, string> query)
|
|
||||||
{
|
|
||||||
if (action == "checkCaptcha")
|
|
||||||
{
|
|
||||||
Settings.Validate().Filter("BaseUrl").ThrowOnError();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var request = new HttpRequestBuilder(Settings.BaseUrl.Trim('/'))
|
|
||||||
.Resource("/pubapi_v2.php?get_token=get_token")
|
|
||||||
.Accept(HttpAccept.Json)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
_httpClient.Get(request);
|
|
||||||
}
|
|
||||||
catch (CloudFlareCaptchaException ex)
|
|
||||||
{
|
|
||||||
return new
|
|
||||||
{
|
|
||||||
captchaRequest = new
|
|
||||||
{
|
|
||||||
host = ex.CaptchaRequest.Host,
|
|
||||||
ray = ex.CaptchaRequest.Ray,
|
|
||||||
siteKey = ex.CaptchaRequest.SiteKey,
|
|
||||||
secretToken = ex.CaptchaRequest.SecretToken,
|
|
||||||
responseUrl = ex.CaptchaRequest.ResponseUrl.FullUri,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new
|
|
||||||
{
|
|
||||||
captchaToken = ""
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else if (action == "getCaptchaCookie")
|
|
||||||
{
|
|
||||||
if (query["responseUrl"].IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
throw new BadRequestException("QueryParam responseUrl invalid.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query["ray"].IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
throw new BadRequestException("QueryParam ray invalid.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query["captchaResponse"].IsNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
throw new BadRequestException("QueryParam captchaResponse invalid.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var request = new HttpRequestBuilder(query["responseUrl"])
|
|
||||||
.AddQueryParam("id", query["ray"])
|
|
||||||
.AddQueryParam("g-recaptcha-response", query["captchaResponse"])
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
request.UseSimplifiedUserAgent = true;
|
|
||||||
request.AllowAutoRedirect = false;
|
|
||||||
|
|
||||||
var response = _httpClient.Get(request);
|
|
||||||
|
|
||||||
var cfClearanceCookie = response.GetCookies()["cf_clearance"];
|
|
||||||
|
|
||||||
return new
|
|
||||||
{
|
|
||||||
captchaToken = cfClearanceCookie
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new { };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
|
||||||
using NzbDrone.Common.Extensions;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Rarbg
|
|
||||||
{
|
|
||||||
public class RarbgRequestGenerator : IIndexerRequestGenerator
|
|
||||||
{
|
|
||||||
private readonly IRarbgTokenProvider _tokenProvider;
|
|
||||||
|
|
||||||
public RarbgSettings Settings { get; set; }
|
|
||||||
|
|
||||||
public RarbgRequestGenerator(IRarbgTokenProvider tokenProvider)
|
|
||||||
{
|
|
||||||
_tokenProvider = tokenProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests("list", null, null));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria searchCriteria)
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests("search", null, "{0}+{1}", searchCriteria.AuthorQuery, searchCriteria.BookQuery));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(AuthorSearchCriteria searchCriteria)
|
|
||||||
{
|
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
|
||||||
|
|
||||||
pageableRequests.Add(GetPagedRequests("search", null, "{0}", searchCriteria.AuthorQuery));
|
|
||||||
|
|
||||||
return pageableRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(string mode, int? tvdbId, string query, params object[] args)
|
|
||||||
{
|
|
||||||
var requestBuilder = new HttpRequestBuilder(Settings.BaseUrl)
|
|
||||||
.Resource("/pubapi_v2.php")
|
|
||||||
.Accept(HttpAccept.Json);
|
|
||||||
|
|
||||||
if (Settings.CaptchaToken.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
requestBuilder.UseSimplifiedUserAgent = true;
|
|
||||||
requestBuilder.SetCookie("cf_clearance", Settings.CaptchaToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
requestBuilder.AddQueryParam("mode", mode);
|
|
||||||
|
|
||||||
if (tvdbId.HasValue)
|
|
||||||
{
|
|
||||||
requestBuilder.AddQueryParam("search_tvdb", tvdbId.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query.IsNotNullOrWhiteSpace())
|
|
||||||
{
|
|
||||||
requestBuilder.AddQueryParam("search_string", string.Format(query, args));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Settings.RankedOnly)
|
|
||||||
{
|
|
||||||
requestBuilder.AddQueryParam("ranked", "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
requestBuilder.AddQueryParam("category", "1;23;24;25;26");
|
|
||||||
requestBuilder.AddQueryParam("limit", "100");
|
|
||||||
requestBuilder.AddQueryParam("token", _tokenProvider.GetToken(Settings));
|
|
||||||
requestBuilder.AddQueryParam("format", "json_extended");
|
|
||||||
requestBuilder.AddQueryParam("app_id", BuildInfo.AppName);
|
|
||||||
|
|
||||||
yield return new IndexerRequest(requestBuilder.Build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
using FluentValidation;
|
|
||||||
using NzbDrone.Core.Annotations;
|
|
||||||
using NzbDrone.Core.Validation;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.Rarbg
|
|
||||||
{
|
|
||||||
public class RarbgSettingsValidator : AbstractValidator<RarbgSettings>
|
|
||||||
{
|
|
||||||
public RarbgSettingsValidator()
|
|
||||||
{
|
|
||||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
||||||
|
|
||||||
RuleFor(c => c.SeedCriteria).SetValidator(_ => new SeedCriteriaSettingsValidator());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RarbgSettings : ITorrentIndexerSettings
|
|
||||||
{
|
|
||||||
private static readonly RarbgSettingsValidator Validator = new RarbgSettingsValidator();
|
|
||||||
|
|
||||||
public RarbgSettings()
|
|
||||||
{
|
|
||||||
BaseUrl = "https://torrentapi.org";
|
|
||||||
RankedOnly = false;
|
|
||||||
MinimumSeeders = IndexerDefaults.MINIMUM_SEEDERS;
|
|
||||||
}
|
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "API URL", HelpText = "URL to Rarbg api, not the website.")]
|
|
||||||
public string BaseUrl { get; set; }
|
|
||||||
|
|
||||||
[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; }
|
|
||||||
|
|
||||||
[FieldDefinition(3, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
|
||||||
public int MinimumSeeders { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(4)]
|
|
||||||
public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings();
|
|
||||||
|
|
||||||
[FieldDefinition(5, Type = FieldType.Number, Label = "Early Download Limit", HelpText = "Time before release date Readarr will download from this indexer, empty is no limit", Advanced = true)]
|
|
||||||
public int? EarlyReleaseLimit { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue