Skip to content

Commit

Permalink
tvstore: add genre results
Browse files Browse the repository at this point in the history
  • Loading branch information
garfield69 committed Aug 5, 2022
1 parent 4615f2d commit ef4d376
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Jackett.Common/Indexers/TVStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
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;
Expand Down Expand Up @@ -141,8 +142,8 @@ private static double UploadFactorCalculator(DateTime dateTime, bool isSeasonPac
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\\\
*/
Expand All @@ -159,6 +160,13 @@ private static double UploadFactorCalculator(DateTime dateTime, bool isSeasonPac
{
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;
Expand Down Expand Up @@ -201,12 +209,16 @@ private static double UploadFactorCalculator(DateTime dateTime, bool isSeasonPac
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);
}
}
Expand Down Expand Up @@ -325,6 +337,7 @@ private enum TorrentParts
TorrentId = 2,
EpisodeInfo = 3,
PublishDate = 6,
Genre = 7,
Files = 10,
SizeBytes = 11,
Seeders = 20,
Expand Down

0 comments on commit ef4d376

Please sign in to comment.