parent
adc79f0eba
commit
47b1157b96
@ -1,31 +0,0 @@
|
|||||||
using NLog;
|
|
||||||
using NzbDrone.Common.Http;
|
|
||||||
using NzbDrone.Core.Configuration;
|
|
||||||
using NzbDrone.Core.Parser;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.KickassTorrents
|
|
||||||
{
|
|
||||||
public class KickassTorrents : HttpIndexerBase<KickassTorrentsSettings>
|
|
||||||
{
|
|
||||||
public override string Name => "Kickass Torrents";
|
|
||||||
|
|
||||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
|
||||||
public override int PageSize => 25;
|
|
||||||
|
|
||||||
public KickassTorrents(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
|
||||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
|
||||||
{
|
|
||||||
return new KickassTorrentsRequestGenerator() { Settings = Settings, PageSize = PageSize };
|
|
||||||
}
|
|
||||||
|
|
||||||
public override IParseIndexerResponse GetParser()
|
|
||||||
{
|
|
||||||
return new KickassTorrentsRssParser() { Settings = Settings };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using NzbDrone.Common.Extensions;
|
|
||||||
using NzbDrone.Core.Parser.Model;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.KickassTorrents
|
|
||||||
{
|
|
||||||
public class KickassTorrentsRssParser : EzrssTorrentRssParser
|
|
||||||
{
|
|
||||||
public KickassTorrentsSettings Settings { get; set; }
|
|
||||||
|
|
||||||
protected override bool PreProcess(IndexerResponse indexerResponse)
|
|
||||||
{
|
|
||||||
if (indexerResponse.HttpResponse.StatusCode == System.Net.HttpStatusCode.NotFound)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.PreProcess(indexerResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ReleaseInfo PostProcess(XElement item, ReleaseInfo releaseInfo)
|
|
||||||
{
|
|
||||||
var verified = item.FindDecendants("verified").SingleOrDefault();
|
|
||||||
|
|
||||||
if (Settings != null && Settings.VerifiedOnly && (string)verified == "0")
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Atm, Kickass supplies 0 as seeders and leechers on the rss feed for recent releases, so set it to null if there aren't any peers.
|
|
||||||
// But only for releases younger than 12h (the real number seems to be close to 14h, but it depends on a number of factors).
|
|
||||||
var torrentInfo = releaseInfo as TorrentInfo;
|
|
||||||
if (torrentInfo.Peers.HasValue && torrentInfo.Peers.Value == 0 && torrentInfo.PublishDate > DateTime.UtcNow.AddHours(-12))
|
|
||||||
{
|
|
||||||
torrentInfo.Seeders = null;
|
|
||||||
torrentInfo.Peers = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.PostProcess(item, releaseInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using FluentValidation;
|
|
||||||
using NzbDrone.Core.Annotations;
|
|
||||||
using NzbDrone.Core.ThingiProvider;
|
|
||||||
using NzbDrone.Core.Validation;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.KickassTorrents
|
|
||||||
{
|
|
||||||
public class KickassTorrentsSettingsValidator : AbstractValidator<KickassTorrentsSettings>
|
|
||||||
{
|
|
||||||
public KickassTorrentsSettingsValidator()
|
|
||||||
{
|
|
||||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class KickassTorrentsSettings : IProviderConfig
|
|
||||||
{
|
|
||||||
private static readonly KickassTorrentsSettingsValidator Validator = new KickassTorrentsSettingsValidator();
|
|
||||||
|
|
||||||
public KickassTorrentsSettings()
|
|
||||||
{
|
|
||||||
BaseUrl = "";
|
|
||||||
VerifiedOnly = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[FieldDefinition(0, Label = "Website URL", HelpText = "Please verify that the url you enter is a trustworthy site.")]
|
|
||||||
public string BaseUrl { get; set; }
|
|
||||||
|
|
||||||
[FieldDefinition(1, Label = "Verified Only", Type = FieldType.Checkbox, HelpText = "By setting this to No you will likely get more junk and unconfirmed releases, so use it with caution.")]
|
|
||||||
public bool VerifiedOnly { get; set; }
|
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue