1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-02-25 15:42:48 +00:00

Implemented Strike categories

This commit is contained in:
unknown 2015-08-22 18:02:41 -06:00
parent f39e23fbe8
commit e566b409b9
7 changed files with 45 additions and 8 deletions

View file

@ -37,7 +37,7 @@ namespace Jackett.Indexers
: base(name: "bB",
description: "bB",
link: "http://www.reddit.com/r/baconbits/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
caps: new TorznabCapabilities(),
manager: i,
client: w,
logger: l,

View file

@ -91,7 +91,7 @@ namespace Jackett.Indexers
if (null != input)
{
input = input.ToLowerInvariant();
var mapping = categoryMapping.Where(m => m.TrackerCategory == input).FirstOrDefault();
var mapping = categoryMapping.Where(m => m.TrackerCategory.ToLowerInvariant() == input.ToLowerInvariant()).FirstOrDefault();
if (mapping != null)
{
return mapping.NewzNabCategory;

View file

@ -33,7 +33,7 @@ namespace Jackett.Indexers
: base(name: "BeyondHD",
description: "Without BeyondHD, your HDTV is just a TV",
link: "https://beyondhd.me/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
caps: new TorznabCapabilities(),
manager: i,
client: w,
logger: l,

View file

@ -35,7 +35,7 @@ namespace Jackett.Indexers
: base(name: "BIT-HDTV",
description: "Home of high definition invites",
link: "https://www.bit-hdtv.com/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
caps: new TorznabCapabilities(),
manager: i,
client: w,
logger: l,

View file

@ -312,7 +312,7 @@ namespace Jackett.Indexers
if (null != input)
{
input = input.ToLowerInvariant();
var mapping = resultMapping.Where(m => m.TrackerCategory == input).FirstOrDefault();
var mapping = resultMapping.Where(m => m.TrackerCategory.ToLowerInvariant() == input.ToLowerInvariant()).FirstOrDefault();
if (mapping != null)
{
return mapping.NewzNabCategory;

View file

@ -14,6 +14,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using Jackett.Models.IndexerConfig;
using System.Collections.Specialized;
namespace Jackett.Indexers
{
@ -27,7 +28,7 @@ namespace Jackett.Indexers
set { configData.Url.Value = value.ToString(); }
}
private string SearchUrl { get { return BaseUri + "api/v2/torrents/search/?category=TV&phrase={0}"; } }
private string SearchUrl { get { return BaseUri + "api/v2/torrents/search/?phrase={0}"; } }
private string DownloadUrl { get { return BaseUri + "torrents/api/download/{0}.torrent"; } }
new ConfigurationDataStrike configData
@ -41,13 +42,34 @@ namespace Jackett.Indexers
: base(name: "Strike",
description: "Torrent search engine",
link: defaultSiteLink,
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
caps: new TorznabCapabilities(),
manager: i,
client: wc,
logger: l,
p: ps,
configData: new ConfigurationDataStrike(defaultSiteLink))
{
AddCategoryMapping("Anime", TorznabCatType.TVAnime);
AddCategoryMapping("Applications", TorznabCatType.PC);
AddCategoryMapping("Books", TorznabCatType.Books);
AddCategoryMapping("Games", TorznabCatType.PCGames);
AddCategoryMapping("Movies", TorznabCatType.Movies);
AddCategoryMapping("TV", TorznabCatType.TV);
AddCategoryMapping("XXX", TorznabCatType.XXX);
AddCategoryMapping("Music", TorznabCatType.Audio);
/*AddCategoryMapping("Movies:Highres Movies", TorznabCatType.MoviesHD);
AddCategoryMapping("Movies:3D Movies", TorznabCatType.Movies3D);
AddCategoryMapping("Books:Ebooks", TorznabCatType.BooksEbook);
AddCategoryMapping("Books:Comics", TorznabCatType.BooksComics);
AddCategoryMapping("Books:Audio Books", TorznabCatType.AudioAudiobook);
AddCategoryMapping("Games:XBOX360", TorznabCatType.ConsoleXbox360);
AddCategoryMapping("Games:Wii", TorznabCatType.ConsoleWii);
AddCategoryMapping("Games:PSP", TorznabCatType.ConsolePSP);
AddCategoryMapping("Games:PS3", TorznabCatType.ConsolePS3);
AddCategoryMapping("Games:PC", TorznabCatType.PCGames);
AddCategoryMapping("Games:Android", TorznabCatType.PCPhoneAndroid);
AddCategoryMapping("Music:Mp3", TorznabCatType.AudioMP3);*/
}
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
@ -83,6 +105,15 @@ namespace Jackett.Indexers
var queryString = query.GetQueryString();
var searchTerm = string.IsNullOrEmpty(queryString) ? DateTime.Now.Year.ToString() : queryString;
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchTerm));
var trackerCategories = MapTorznabCapsToTrackers(query, mapChildrenCatsToParent: true);
// This tracker can only search one cat at a time, otherwise search all and filter results
if (trackerCategories.Count == 1)
{
episodeSearchUrl += "&category=" + trackerCategories[0];
}
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl, string.Empty);
try
{
@ -94,6 +125,12 @@ namespace Jackett.Indexers
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
if (trackerCategories.Count > 0 && !trackerCategories.Contains((string)result["torrent_category"]))
{
continue;
}
release.Category = MapTrackerCatToNewznab((string)result["torrent_category"]);
release.Title = (string)result["torrent_title"];
release.Description = release.Title;
release.Seeders = (int)result["seeds"];

View file

@ -10,7 +10,7 @@ namespace Jackett.Models
{
public CategoryMapping(string trackerCat, int newzCat)
{
TrackerCategory = trackerCat.ToLowerInvariant();
TrackerCategory = trackerCat;
NewzNabCategory = newzCat;
}