1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-02-24 07:10:44 +00:00

Revert "rarbg: optional .torrent from itorrents.org resolves #4063"

This reverts commit 56b8a81248.
This commit is contained in:
kaso17 2018-10-30 12:08:38 +01:00
parent 4c6b946cf9
commit 000c57b9c1
2 changed files with 17 additions and 26 deletions

View file

@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig.Bespoke;
using Jackett.Common.Models.IndexerConfig;
using Jackett.Common.Services.Interfaces;
using Jackett.Common.Utils;
using Jackett.Common.Utils.Clients;
@ -18,10 +18,21 @@ namespace Jackett.Common.Indexers
public class Rarbg : BaseWebIndexer
{
// API doc: https://torrentapi.org/apidocs_v2.txt
private static readonly string defaultSiteLink = "https://torrentapi.org/";
private string BaseUri => ConfigData.BaseUri.Value;
private string ApiEndpoint => BaseUri + "pubapi_v2.php";
private bool ItorrentsEnabled => ConfigData.ItorrentsEnabled.Value;
private Uri BaseUri
{
get { return new Uri(configData.Url.Value); }
set { configData.Url.Value = value.ToString(); }
}
private string ApiEndpoint { get { return BaseUri + "pubapi_v2.php"; } }
private new ConfigurationDataUrl configData
{
get { return (ConfigurationDataUrl)base.configData; }
set { base.configData = value; }
}
private DateTime lastTokenFetch;
private string token;
@ -31,8 +42,6 @@ namespace Jackett.Common.Indexers
private bool HasValidToken { get { return !string.IsNullOrEmpty(token) && lastTokenFetch > DateTime.Now - TOKEN_DURATION; } }
private ConfigurationDataRarbg ConfigData => (ConfigurationDataRarbg)configData;
public Rarbg(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)
: base(name: "RARBG",
description: "RARBG is a Public torrent site for MOVIES / TV / GENERAL",
@ -42,7 +51,7 @@ namespace Jackett.Common.Indexers
client: wc,
logger: l,
p: ps,
configData: new ConfigurationDataRarbg())
configData: new ConfigurationDataUrl(defaultSiteLink))
{
Encoding = Encoding.GetEncoding("windows-1252");
Language = "en-us";
@ -206,9 +215,7 @@ namespace Jackett.Common.Indexers
release.MagnetUri = new Uri(item.Value<string>("download"));
release.InfoHash = release.MagnetUri.ToString().Split(':')[3].Split('&')[0];
if (ItorrentsEnabled) {
release.Link = new Uri("http://itorrents.org/torrent/" + release.InfoHash.ToUpper() + ".torrent");
}
release.Comments = new Uri(item.Value<string>("info_page"));
release.Guid = release.MagnetUri;

View file

@ -1,16 +0,0 @@
namespace Jackett.Common.Models.IndexerConfig.Bespoke
{
internal class ConfigurationDataRarbg : ConfigurationData
{
public HiddenItem BaseUri { get; set; }
public DisplayItem ItorrentsWarning { get; private set; }
public BoolItem ItorrentsEnabled { get; private set; }
public ConfigurationDataRarbg()
{
BaseUri = new HiddenItem { Name = "BaseLUri", Value = "https://torrentapi.org/" };
ItorrentsWarning = new DisplayItem("The RarBG API provides only magnets. Enabling the option below will include a .torrent link from Itorrents.org.<br /> <b>However</b>, be aware that Itorrents.org does not store .torrent files for all RarBG magnets, and after a new magnet is released it may take several hours before a .torrent file becomes available on Itorrents.org's DB.<br />Also, if Itorrents.org enable cloudflare DDOS protection, this link will most likely timeout.") { Name = "Itorrents.org Link" };
ItorrentsEnabled = new BoolItem() { Name = "Include .torrent link from Itorrents.org (Optional)", Value = false };
}
}
}