Skip to content

Commit

Permalink
desitorrents: migrate to c#. resolves #11904 (#11909)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilike2burnthing committed Jun 15, 2021
1 parent 3b5ae2c commit e347d38
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 275 deletions.
274 changes: 0 additions & 274 deletions src/Jackett.Common/Definitions/desitorrents.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Jackett.Common/Indexers/Abstract/GazelleTracker.cs
Expand Up @@ -228,7 +228,7 @@ protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuer
? "Tags: " + string.Join(", ", tags) + "\n"
: null;
Uri poster = null;
if (!string.IsNullOrEmpty(cover))
if (!string.IsNullOrEmpty(cover) && cover.StartsWith("http"))

This comment has been minimized.

Copy link
@garfield69

garfield69 Jun 15, 2021

Contributor

so you're dropping any poster that does not have a full url?
it's not uncommon for some sites to require the indexer to prefix the sitelink to provided links, so I would have gone for something like:

                    if (!string.IsNullOrEmpty(cover))
                        poster = (cover.StartsWith("http")) ? new Uri(cover) : new Uri(SiteLink + cover);

and thus cater for either.
note: untested, may need refinement, but you get the gist.

poster = new Uri(cover);
var release = new ReleaseInfo
{
Expand Down
80 changes: 80 additions & 0 deletions src/Jackett.Common/Indexers/DesiTorrents.cs
@@ -0,0 +1,80 @@
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.Clients;
using Newtonsoft.Json.Linq;
using NLog;

namespace Jackett.Common.Indexers
{
[ExcludeFromCodeCoverage]
public class DesiTorrents : GazelleTracker
{
public DesiTorrents(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps,
ICacheService cs)
: base(id: "desitorrents",
name: "DesiTorrents",
description: "Desitorrents is a Private Torrent Tracker for BOLLYWOOD / TOLLYWOOD / GENERAL",
link: "https://desitorrents.tv/",
caps: new TorznabCapabilities
{
TvSearchParams = new List<TvSearchParam>
{
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
},
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q
},
MusicSearchParams = new List<MusicSearchParam>
{
MusicSearchParam.Q
},
BookSearchParams = new List<BookSearchParam>
{
BookSearchParam.Q
}
},
configService: configService,
client: wc,
logger: l,
p: ps,
cs: cs,
supportsFreeleechTokens: false,
has2Fa: true
)
{
Language = "en-us";
Type = "private";

AddCategoryMapping(1, TorznabCatType.Movies, "Movies");
AddCategoryMapping(2, TorznabCatType.TV, "Tv shows");
AddCategoryMapping(3, TorznabCatType.Audio, "Music");
AddCategoryMapping(4, TorznabCatType.BooksEBook, "ebooks");
AddCategoryMapping(5, TorznabCatType.TVSport, "Sports");
AddCategoryMapping(6, TorznabCatType.PCGames, "Games");
}

protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = await base.PerformQuery(query);
foreach (var release in releases)
{
release.MinimumRatio = 0.6;
release.MinimumSeedTime = 259200;
}
return releases;
}

protected override bool ReleaseInfoPostParse(ReleaseInfo release, JObject torrent, JObject result)
{
// Add missing category information
var category = (string)result["category"];
release.Category = MapTrackerCatToNewznab(category);
return true;
}
}
}
1 change: 1 addition & 0 deletions src/Jackett.Updater/Program.cs
Expand Up @@ -293,6 +293,7 @@ private void ProcessUpdate(UpdaterConsoleOptions options)
"Definitions/cztorrent.yml",
"Definitions/darmowetorenty.yml", // migrated to C#
"Definitions/demonsite.yml",
"Definitions/desitorrents.yml", // migrated to C#
"Definitions/digbt.yml",
"Definitions/documentarytorrents.yml",
"Definitions/downloadville.yml",
Expand Down

0 comments on commit e347d38

Please sign in to comment.