1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-03-10 06:03:09 +00:00

greatposterwall: optimize search results (#12980)

Also change from Seals.

Co-authored-by: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com>
Co-authored-by: garfield69 <garfieldsixtynine@gmail.com>
This commit is contained in:
qwerty 2022-02-23 12:09:34 +08:00 committed by GitHub
parent bc3f7da145
commit 50e8c7e827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 144 additions and 88 deletions

View file

@ -500,7 +500,7 @@ A third-party Golang SDK for Jackett is available from [webtor-io/go-jackett](ht
* SceneRush
* SceneTime
* SDBits [![(invite needed)][inviteneeded]](#)
* Seals
* GreatPosterWall (GPW)
* Secret Cinema
* SeedFile (SF)
* Shareisland

View file

@ -0,0 +1,141 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Jackett.Common.Indexers.Abstract;
using Jackett.Common.Models;
using Jackett.Common.Services.Interfaces;
using Jackett.Common.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using WebClient = Jackett.Common.Utils.Clients.WebClient;
namespace Jackett.Common.Indexers
{
[ExcludeFromCodeCoverage]
public class GreatPosterWall : GazelleTracker
{
public GreatPosterWall(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps,
ICacheService cs)
: base(id: "greatposterwall",
name: "GreatPosterWall",
description: "GreatPosterWall (GPW) is a CHINESE Private site for MOVIES",
link: "https://greatposterwall.com/",
caps: new TorznabCapabilities
{
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q, MovieSearchParam.ImdbId
}
},
configService: configService,
client: wc,
logger: l,
p: ps,
cs: cs,
supportsFreeleechTokens: true,
imdbInTags: false,
has2Fa: true,
useApiKey: false,
usePassKey: false,
instructionMessageOptional: null
)
{
Language = "zh-CN";
Type = "private";
AddCategoryMapping(1, TorznabCatType.Movies, "Movies 电影");
}
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
// GPW uses imdbid in the searchstr so prevent cataloguenumber or taglist search.
if (query.IsImdbQuery)
{
query.SearchTerm = query.ImdbID;
query.ImdbID = null;
}
return await base.PerformQuery(query);
}
protected override bool ReleaseInfoPostParse(ReleaseInfo release, JObject torrent, JObject result)
{
// override release title
var groupName = WebUtility.HtmlDecode((string)result["groupName"]);
var groupSubName = WebUtility.HtmlDecode((string)result["groupSubName"]);
var groupYear = (string)result["groupYear"];
var title = new StringBuilder();
title.Append(groupName);
if (!string.IsNullOrEmpty(groupSubName))
title.Append(" " + groupSubName + " ");
if (!string.IsNullOrEmpty(groupYear) && groupYear != "0")
title.Append(" [" + groupYear + "]");
var torrentId = torrent["torrentId"];
var flags = new List<string>();
var codec = (string)torrent["codec"];
if (!string.IsNullOrEmpty(codec))
flags.Add(codec);
var source = (string)torrent["source"];
if (!string.IsNullOrEmpty(source))
flags.Add(source);
var resolution = (string)torrent["resolution"];
if (!string.IsNullOrEmpty(resolution))
flags.Add(resolution);
var container = (string)torrent["container"];
if (!string.IsNullOrEmpty(container))
flags.Add(container);
var processing = (string)torrent["processing"];
if (!string.IsNullOrEmpty(processing))
flags.Add(processing);
if (flags.Count > 0)
title.Append(" " + string.Join(" / ", flags));
release.Title = title.ToString();
switch ((string)torrent["freeType"])
{
case "11":
release.DownloadVolumeFactor = 0.75;
break;
case "12":
release.DownloadVolumeFactor = 0.5;
break;
case "13":
release.DownloadVolumeFactor = 0.25;
break;
case "1":
release.DownloadVolumeFactor = 0;
break;
case "2":
release.DownloadVolumeFactor = 0;
release.UploadVolumeFactor = 0;
break;
}
var isPersonalFreeleech = (bool?)torrent["isPersonalFreeleech"];
if (isPersonalFreeleech != null && isPersonalFreeleech == true)
release.DownloadVolumeFactor = 0;
var imdbID = (string)result["imdbId"];
if (!string.IsNullOrEmpty(imdbID))
release.Imdb = ParseUtil.GetImdbID(imdbID);
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800; // 48 hours
// tag each results with Movie cats.
release.Category = new List<int> { TorznabCatType.Movies.ID };
return true;
}
}
}

View file

@ -1,86 +0,0 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Jackett.Common.Indexers.Abstract;
using Jackett.Common.Models;
using Jackett.Common.Services.Interfaces;
using Jackett.Common.Utils;
using Jackett.Common.Utils.Clients;
using NLog;
namespace Jackett.Common.Indexers
{
[ExcludeFromCodeCoverage]
public class Seals : GazelleTracker
{
public Seals(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps,
ICacheService cs)
: base(id: "seals",
name: "Seals",
description: "Seals is a CHINESE Private site for MOVIES / TV",
link: StringUtil.FromBase64("aHR0cHM6Ly9ncmVhdHBvc3RlcndhbGwuY29tLw=="),
caps: new TorznabCapabilities
{
TvSearchParams = new List<TvSearchParam>
{
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
},
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q, MovieSearchParam.ImdbId
}
},
configService: configService,
client: wc,
logger: l,
p: ps,
cs: cs,
supportsFreeleechTokens: true,
imdbInTags: false,
has2Fa: true,
useApiKey: false,
usePassKey: false,
instructionMessageOptional: null
)
{
Language = "zh-CN";
Type = "private";
// Seals does not have categories so these are just to tag the results with both for torznab apps.
AddCategoryMapping(1, TorznabCatType.Movies, "Movies 电影");
AddCategoryMapping(2, TorznabCatType.TV, "TV 电视");
}
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
// Seals does not support categories so drop cat filtering.
query.Categories = new int[0];
// Seals uses imdbid in the searchstr so prevent cataloguenumber or taglist search.
if (query.IsImdbQuery)
{
query.SearchTerm = query.ImdbID;
query.ImdbID = null;
}
var releases = await base.PerformQuery(query);
foreach (var release in releases)
{
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800; // 48 hours
// tag each results with both Movie and TV cats.
release.Category = new List<int> { TorznabCatType.Movies.ID, TorznabCatType.TV.ID };
// Seals loads artist with the movie director and the gazelleTracker abstract
// places it in front of the movie separated with a dash.
// eg. Keishi Ohtomo - Rurouni Kenshin Part II: Kyoto Inferno [2014] [Feature Film] 1080p / MKV / x264 / 0
// We need to strip it or Radarr will not get a title match for automatic DL
var artistEndsAt = release.Title.IndexOf(" - ");
if (artistEndsAt > -1)
{
release.Title = release.Title.Substring(artistEndsAt + 3);
}
}
return releases;
}
}
}

View file

@ -42,7 +42,6 @@ namespace Jackett.Common.Services
{
{"audiobooktorrents", "abtorrents"},
{"broadcastthenet", "broadcasthenet"},
{"todotorrents", "dontorrent"},
{"hdreactor", "hdhouse"},
{"icetorrent", "speedapp"},
{"kickasstorrent-kathow", "kickasstorrents-ws"},
@ -54,7 +53,9 @@ namespace Jackett.Common.Services
{"puntorrent", "puntotorrent"},
{"rstorrent", "redstartorrent"},
{"scenefz", "speedapp"},
{"seals", "greatposterwall"},
{"tehconnectionme", "anthelion"},
{"todotorrents", "dontorrent"},
{"torrentgalaxyorg", "torrentgalaxy"},
{"transmithenet", "nebulance"},
{"xtremezone", "speedapp"},