bakabt: add freeleech only option (#14377)

This commit is contained in:
Bogdan 2023-05-26 20:44:36 +03:00 committed by GitHub
parent 97873506e3
commit 2594fdba13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -164,6 +164,14 @@ namespace Jackett.Common.Indexers
foreach (var row in rows)
{
var downloadVolumeFactor = row.QuerySelector("span.freeleech") != null ? 0 : 1;
// Skip non-freeleech results when freeleech only is set
if (configData.FreeleechOnly.Value && downloadVolumeFactor != 0)
{
continue;
}
var qTitleLink = row.QuerySelector("a.title, a.alt_title");
if (qTitleLink == null)
continue;
@ -247,7 +255,7 @@ namespace Jackett.Common.Indexers
else
release.PublishDate = DateTime.ParseExact(dateStr, "dd MMM yy", CultureInfo.InvariantCulture);
release.DownloadVolumeFactor = row.QuerySelector("span.freeleech") != null ? 0 : 1;
release.DownloadVolumeFactor = downloadVolumeFactor;
release.UploadVolumeFactor = 1;
releases.Add(release);

View File

@ -5,12 +5,14 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke
[ExcludeFromCodeCoverage]
internal class ConfigurationDataBakaBT : ConfigurationDataBasicLogin
{
public BoolConfigurationItem FreeleechOnly { get; private set; }
public BoolConfigurationItem AddRomajiTitle { get; private set; }
public BoolConfigurationItem AppendSeason { get; private set; }
public ConfigurationDataBakaBT(string instructionMessageOptional = null)
: base(instructionMessageOptional)
{
FreeleechOnly = new BoolConfigurationItem("Show freeleech only") { Value = false };
AddRomajiTitle = new BoolConfigurationItem("Add releases for Romaji Title") { Value = true };
AppendSeason = new BoolConfigurationItem("Append Season for Sonarr Compatibility") { Value = false };
}