tvstore: add genre results

This commit is contained in:
Garfield69
2022-08-05 21:42:37 +12:00
parent 4615f2d89b
commit ef4d3760b6

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using AngleSharp.Html.Parser;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig.Bespoke;
using Jackett.Common.Services.Interfaces;
@@ -141,8 +142,8 @@ namespace Jackett.Common.Indexers
try
{
/* Content Looks like this
* 2\15\2\1\1727\207244\1x08 \[WebDL-720p - Eng - AJP69]\gb\2018-03-09 08:11:53\akció, kaland, sci-fi \0\0\1\191170047\1\0\Anonymous\50\0\0\\0\4\0\174\0\
* 1\ 0\0\1\1727\207243\1x08 \[WebDL-1080p - Eng - AJP69]\gb\2018-03-09 08:11:49\akció, kaland, sci-fi \0\0\1\305729738\1\0\Anonymous\50\0\0\\0\8\0\102\0\0\0\0\1\\\
* 2\15\2\1\1727\207244\1x08 \[WebDL-720p - Eng - AJP69]\gb\2018-03-09 08:11:53\<a href='#m=4'><span class='mufaj'>dráma</span></a>, <a href='#m=13'><span class='mufaj'>romantika</span></a>, <a href='#m=20'><span class='mufaj'>orvosi</span></a>&nbsp;\0\0\1\191170047\1\0\Anonymous\50\0\0\\0\4\0\174\0\
* 1\ 0\0\1\1727\207243\1x08 \[WebDL-1080p - Eng - AJP69]\gb\2018-03-09 08:11:49\<a href='#m=4'><span class='mufaj'>dráma</span></a>, <a href='#m=13'><span class='mufaj'>romantika</span></a>, <a href='#m=20'><span class='mufaj'>orvosi</span></a>&nbsp;\0\0\1\305729738\1\0\Anonymous\50\0\0\\0\8\0\102\0\0\0\0\1\\\
* First 3 items per page are total results, results per page, and results this page
* There is also a tail of ~4 items after the results for some reason. Looks like \1\\\
*/
@@ -159,6 +160,13 @@ namespace Jackett.Common.Indexers
{
var torrentId = row[(int)TorrentParts.TorrentId];
var downloadLink = new Uri(DownloadUrl + "?id=" + torrentId);
// the genre field is a html string, and we just want the text
var parser = new HtmlParser();
var dom = parser.ParseDocument(row[(int)TorrentParts.Genre]);
var genres = dom.QuerySelector("*").TextContent.Replace("\xA0", "");
var description = "";
if (!string.IsNullOrWhiteSpace(genres))
description = genres;
var imdbId = _imdbLookup.TryGetValue(int.Parse(row[(int)TorrentParts.InternalId]), out var imdb)
? (long?)imdb
: null;
@@ -201,12 +209,16 @@ namespace Jackett.Common.Indexers
Seeders = seeders,
Peers = leechers + seeders,
Grabs = grabs,
Description = description,
MinimumRatio = 1,
MinimumSeedTime = 172800, // 48 hours
DownloadVolumeFactor = 1,
UploadVolumeFactor = UploadFactorCalculator(publishDate, isSeasonPack),
Imdb = imdbId
};
if (release.Genres == null)
release.Genres = new List<string>();
release.Genres = release.Genres.Union(genres.Split(',')).ToList();
releases.Add(release);
}
}
@@ -325,6 +337,7 @@ namespace Jackett.Common.Indexers
TorrentId = 2,
EpisodeInfo = 3,
PublishDate = 6,
Genre = 7,
Files = 10,
SizeBytes = 11,
Seeders = 20,