1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-02-24 23:22:46 +00:00

Add HD-Only

This commit is contained in:
kaso17 2017-02-02 14:53:28 +01:00
parent e2937762d4
commit 18908be38f
4 changed files with 78 additions and 6 deletions

View file

@ -132,7 +132,7 @@ namespace Jackett.Indexers.Abstract
release.Title += " [" + releaseType + "]";
release.Description = "";
if (tags != null)
if (tags != null && tags.Count > 0 && (string)tags[0] != "")
release.Description += "Tags: " + string.Join(", ", tags) + "\n";
if (r["torrents"] is JArray)
@ -141,13 +141,15 @@ namespace Jackett.Indexers.Abstract
{
ReleaseInfo release2 = (ReleaseInfo)release.Clone();
FillReleaseInfoFromJson(release2, torrent);
releases.Add(release2);
if (ReleaseInfoPostParse(release2, torrent, r))
releases.Add(release2);
}
}
else
{
FillReleaseInfoFromJson(release, r);
releases.Add(release);
if (ReleaseInfoPostParse(release, r, r))
releases.Add(release);
}
}
}
@ -159,6 +161,12 @@ namespace Jackett.Indexers.Abstract
return releases;
}
// hook to add/modify the parsed information, return false to exclude the torrent from the results
protected virtual bool ReleaseInfoPostParse(ReleaseInfo release, JObject torrent, JObject result)
{
return true;
}
void FillReleaseInfoFromJson(ReleaseInfo release, JObject torrent)
{
var torrentId = torrent["torrentId"];

View file

@ -124,7 +124,7 @@ namespace Jackett.Indexers
{
if (null != input)
{
var mapping = categoryMapping.Where(m => m.TrackerCategory.ToLowerInvariant() == input.ToLowerInvariant()).FirstOrDefault();
var mapping = categoryMapping.Where(m => m.TrackerCategory != null && m.TrackerCategory.ToLowerInvariant() == input.ToLowerInvariant()).FirstOrDefault();
if (mapping != null)
{
return mapping.NewzNabCategory;
@ -137,7 +137,7 @@ namespace Jackett.Indexers
{
if (null != input)
{
var mapping = categoryMapping.Where(m => m.TrackerCategoryDesc.ToLowerInvariant() == input.ToLowerInvariant()).FirstOrDefault();
var mapping = categoryMapping.Where(m => m.TrackerCategoryDesc != null && m.TrackerCategoryDesc.ToLowerInvariant() == input.ToLowerInvariant()).FirstOrDefault();
if (mapping != null)
{
return mapping.NewzNabCategory;
@ -560,7 +560,7 @@ namespace Jackett.Indexers
}
}
protected List<string> MapTorznabCapsToTrackers(TorznabQuery query, bool mapChildrenCatsToParent = false)
protected virtual List<string> MapTorznabCapsToTrackers(TorznabQuery query, bool mapChildrenCatsToParent = false)
{
var result = new List<string>();
foreach (var cat in query.Categories)

View file

@ -0,0 +1,63 @@
using Jackett.Models;
using NLog;
using Jackett.Services;
using Jackett.Utils.Clients;
using Jackett.Indexers.Abstract;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Web;
namespace Jackett.Indexers
{
public class HDOnly : GazelleTracker, IIndexer
{
public HDOnly(IIndexerManagerService indexerManager, IWebClient webClient, Logger logger, IProtectionService protectionService)
: base(name: "HD-Only",
desc: null,
link: "https://hd-only.org/",
indexerManager: indexerManager,
logger: logger,
protectionService: protectionService,
webClient: webClient
)
{
Language = "fr-fr";
Type = "private";
// a few releases have "category":"S\u00e9ries" set
AddCategoryMapping(null, TorznabCatType.TV, "Séries");
// releaseType mappings
AddCategoryMapping(1, TorznabCatType.Movies, "Film");
AddCategoryMapping(3, TorznabCatType.TVAnime, "Dessin animé");
AddCategoryMapping(5, TorznabCatType.TV, "Série");
AddCategoryMapping(6, TorznabCatType.TVAnime, "Série Animée");
AddCategoryMapping(7, TorznabCatType.MoviesOther, "Film d'animation");
AddCategoryMapping(9, TorznabCatType.AudioVideo, "Concert");
AddCategoryMapping(11, TorznabCatType.TVDocumentary, "Documentaire");
AddCategoryMapping(13, TorznabCatType.MoviesOther, "Court-métrage");
AddCategoryMapping(14, TorznabCatType.MoviesOther, "Clip");
AddCategoryMapping(15, TorznabCatType.MoviesOther, "Démonstration");
AddCategoryMapping(16, TorznabCatType.MoviesOther, "Bonus de BD");
AddCategoryMapping(21, TorznabCatType.Other, "Autre");
}
protected override bool ReleaseInfoPostParse(ReleaseInfo release, JObject torrent, JObject result)
{
// releaseType is used for categories
var category = (string)result["category"];
if (category == null)
{
var releaseType = (string)result["releaseType"];
release.Category = MapTrackerCatDescToNewznab(releaseType);
}
return true;
}
protected override List<string> MapTorznabCapsToTrackers(TorznabQuery query, bool mapChildrenCatsToParent = false)
{
// don't use category filtering
return new List<string>();
}
}
}

View file

@ -178,6 +178,7 @@
<Compile Include="Controllers\TorznabController.cs" />
<Compile Include="Controllers\DownloadController.cs" />
<Compile Include="Engine.cs" />
<Compile Include="Indexers\HDOnly.cs" />
<Compile Include="Indexers\PiXELHD.cs" />
<Compile Include="Indexers\Hardbay.cs" />
<Compile Include="Indexers\Rarbg.cs" />