enable IMDb ID support for AlphaRatio (#6074)

added checking results tags for imdbid on GazelleTracker abstract
added searching with imdbid on GazelleTracker abstract via taglist query
This commit is contained in:
arielbeje 2019-10-03 03:45:15 +03:00 committed by garfield69
parent fad548cce3
commit 0abc2df38d
2 changed files with 31 additions and 4 deletions

View File

@ -23,6 +23,7 @@ namespace Jackett.Common.Indexers.Abstract
protected string DownloadUrl { get { return SiteLink + "torrents.php?action=download&usetoken=" + (useTokens ? "1" : "0") + "&id="; } }
protected string DetailsUrl { get { return SiteLink + "torrents.php?torrentid="; } }
protected bool supportsFreeleechTokens;
protected bool imdbInTags;
protected bool supportsCategories = true; // set to false if the tracker doesn't include the categories in the API search results
protected bool useTokens = false;
@ -32,7 +33,7 @@ namespace Jackett.Common.Indexers.Abstract
set { base.configData = value; }
}
public GazelleTracker(IIndexerConfigurationService configService, Utils.Clients.WebClient webClient, Logger logger, IProtectionService protectionService, string name, string desc, string link, bool supportsFreeleechTokens)
public GazelleTracker(IIndexerConfigurationService configService, Utils.Clients.WebClient webClient, Logger logger, IProtectionService protectionService, string name, string desc, string link, bool supportsFreeleechTokens, bool imdbInTags = false)
: base(name: name,
description: desc,
link: link,
@ -45,6 +46,7 @@ namespace Jackett.Common.Indexers.Abstract
{
Encoding = Encoding.UTF8;
this.supportsFreeleechTokens = supportsFreeleechTokens;
this.imdbInTags = imdbInTags;
if (supportsFreeleechTokens)
{
@ -112,7 +114,10 @@ namespace Jackett.Common.Indexers.Abstract
if (!string.IsNullOrWhiteSpace(query.ImdbID))
{
queryCollection.Add("cataloguenumber", query.ImdbID);
if (this.imdbInTags)
queryCollection.Add("taglist", query.ImdbID);
else
queryCollection.Add("cataloguenumber", query.ImdbID);
}
else if (!string.IsNullOrWhiteSpace(searchString))
{
@ -183,6 +188,26 @@ namespace Jackett.Common.Indexers.Abstract
if (tags != null && tags.Count > 0 && (string)tags[0] != "")
release.Description += "Tags: " + string.Join(", ", tags) + "\n";
if (imdbInTags)
{
int? currentTagImdbId;
// Check if multiple IMDb IDs exist
// If they do, show no IMDb link
foreach (var tag in tags)
{
currentTagImdbId = ParseUtil.GetImdbID((string)tag);
if (currentTagImdbId != null && release.Imdb == null)
{
release.Imdb = currentTagImdbId;
}
else if (currentTagImdbId != null)
{
release.Imdb = null;
break;
}
}
}
if (r["torrents"] is JArray)
{
foreach (JObject torrent in r["torrents"])

View File

@ -8,7 +8,7 @@ namespace Jackett.Common.Indexers
{
public class AlphaRatio : GazelleTracker
{
public AlphaRatio(IIndexerConfigurationService configService, WebClient webClient, Logger logger, IProtectionService protectionService)
public AlphaRatio(IIndexerConfigurationService configService, Utils.Clients.WebClient webClient, Logger logger, IProtectionService protectionService)
: base(name: "AlphaRatio",
desc: "AlphaRatio (AR) is a Private Torrent Tracker for 0DAY / GENERAL",
link: "https://alpharatio.cc/",
@ -16,11 +16,13 @@ namespace Jackett.Common.Indexers
logger: logger,
protectionService: protectionService,
webClient: webClient,
supportsFreeleechTokens: true
supportsFreeleechTokens: true,
imdbInTags: true
)
{
Language = "en-us";
Type = "private";
TorznabCaps.SupportsImdbMovieSearch = true;
AddCategoryMapping(1, TorznabCatType.TVSD, "TvSD");
AddCategoryMapping(2, TorznabCatType.TVHD, "TvHD");