From e4ef1c3af0598c1aa73555ee43e27e51ae42433f Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 30 Aug 2021 22:20:40 -0400 Subject: [PATCH] Fixed: Convert DesiTorrents to Gazelle Fixes #220 --- .../IndexerDefinitionUpdateService.cs | 1 + .../Indexers/Definitions/DesiTorrents.cs | 80 +++++++++++++++++++ .../Definitions/Gazelle/GazelleParser.cs | 2 +- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs diff --git a/src/NzbDrone.Core/IndexerVersions/IndexerDefinitionUpdateService.cs b/src/NzbDrone.Core/IndexerVersions/IndexerDefinitionUpdateService.cs index 02b38fa61..33e5eb487 100644 --- a/src/NzbDrone.Core/IndexerVersions/IndexerDefinitionUpdateService.cs +++ b/src/NzbDrone.Core/IndexerVersions/IndexerDefinitionUpdateService.cs @@ -33,6 +33,7 @@ namespace NzbDrone.Core.IndexerVersions "beyond-hd", "beyond-hd-oneurl", "danishbytes", + "desitorrents", "hdbits", "shareisland" }; diff --git a/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs new file mode 100644 index 000000000..f1c9e260d --- /dev/null +++ b/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using NLog; +using NzbDrone.Core.Configuration; +using NzbDrone.Core.Indexers.Gazelle; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Parser.Model; + +namespace NzbDrone.Core.Indexers.Definitions +{ + public class DesiTorrents : Gazelle.Gazelle + { + public override string Name => "DesiTorrents"; + public override string[] IndexerUrls => new string[] { "https://desitorrents.tv/" }; + public override string Description => "Desitorrents is a Private Torrent Tracker for BOLLYWOOD / TOLLYWOOD / GENERAL"; + public override IndexerPrivacy Privacy => IndexerPrivacy.Private; + + public DesiTorrents(IIndexerHttpClient httpClient, IEventAggregator eventAggregator, IIndexerStatusService indexerStatusService, IConfigService configService, Logger logger) + : base(httpClient, eventAggregator, indexerStatusService, configService, logger) + { + } + + public override IParseIndexerResponse GetParser() + { + return new DesiTorrentsParser(Settings, Capabilities); + } + + protected override IndexerCapabilities SetCapabilities() + { + var caps = new IndexerCapabilities + { + TvSearchParams = new List + { + TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep + }, + MovieSearchParams = new List + { + MovieSearchParam.Q + }, + MusicSearchParams = new List + { + MusicSearchParam.Q + }, + BookSearchParams = new List + { + BookSearchParam.Q + } + }; + + caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.Movies, "Movies"); + caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TV, "Tv shows"); + caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.Audio, "Music"); + caps.Categories.AddCategoryMapping(4, NewznabStandardCategory.BooksEBook, "ebooks"); + caps.Categories.AddCategoryMapping(5, NewznabStandardCategory.TVSport, "Sports"); + caps.Categories.AddCategoryMapping(6, NewznabStandardCategory.PCGames, "Games"); + + return caps; + } + } + + public class DesiTorrentsParser : Gazelle.GazelleParser + { + public DesiTorrentsParser(GazelleSettings settings, IndexerCapabilities capabilities) + : base(settings, capabilities) + { + } + + public override IList ParseResponse(IndexerResponse indexerResponse) + { + var releases = base.ParseResponse(indexerResponse); + + foreach (TorrentInfo release in releases) + { + release.MinimumRatio = 0.6; + release.MinimumSeedTime = 259200; + } + + return releases; + } + } +} diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs index aa1a463c7..48be951d2 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.Indexers.Gazelle public Action, DateTime?> CookiesUpdater { get; set; } - public IList ParseResponse(IndexerResponse indexerResponse) + public virtual IList ParseResponse(IndexerResponse indexerResponse) { var torrentInfos = new List();