From 3bbadb516db6c79e77181fd5fa28dfa83232c254 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Thu, 7 Oct 2021 15:42:49 -0500 Subject: [PATCH] New: (DesiTorrents) Convert from Gazelle to UNIT3D Fixes #532 --- .../Migration/013_desi_gazelle_to_unit3d.cs | 14 ++++++++++++++ .../Indexers/Definitions/DesiTorrents.cs | 18 ++++++++++-------- .../Definitions/UNIT3D/Unit3dParser.cs | 2 +- 3 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 src/NzbDrone.Core/Datastore/Migration/013_desi_gazelle_to_unit3d.cs diff --git a/src/NzbDrone.Core/Datastore/Migration/013_desi_gazelle_to_unit3d.cs b/src/NzbDrone.Core/Datastore/Migration/013_desi_gazelle_to_unit3d.cs new file mode 100644 index 000000000..c066fa8a8 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/013_desi_gazelle_to_unit3d.cs @@ -0,0 +1,14 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(13)] + public class desi_gazelle_to_unit3d : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Update.Table("Indexers").Set(new { ConfigContract = "Unit3dSettings", Enable = 0 }).Where(new { Implementation = "DesiTorrents" }); + } + } +} diff --git a/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs b/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs index f1c9e260d..572f9222f 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs @@ -1,16 +1,18 @@ using System.Collections.Generic; +using System.Linq; using NLog; using NzbDrone.Core.Configuration; -using NzbDrone.Core.Indexers.Gazelle; +using NzbDrone.Core.Indexers.Definitions.UNIT3D; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Indexers.Definitions { - public class DesiTorrents : Gazelle.Gazelle + public class DesiTorrents : Unit3dBase { public override string Name => "DesiTorrents"; - public override string[] IndexerUrls => new string[] { "https://desitorrents.tv/" }; + public override string Language => "en-US"; + public override string[] IndexerUrls => new[] { "https://desitorrents.tv/" }; public override string Description => "Desitorrents is a Private Torrent Tracker for BOLLYWOOD / TOLLYWOOD / GENERAL"; public override IndexerPrivacy Privacy => IndexerPrivacy.Private; @@ -21,7 +23,7 @@ namespace NzbDrone.Core.Indexers.Definitions public override IParseIndexerResponse GetParser() { - return new DesiTorrentsParser(Settings, Capabilities); + return new DesiTorrentsParser(Settings, Capabilities.Categories); } protected override IndexerCapabilities SetCapabilities() @@ -47,7 +49,7 @@ namespace NzbDrone.Core.Indexers.Definitions }; caps.Categories.AddCategoryMapping(1, NewznabStandardCategory.Movies, "Movies"); - caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TV, "Tv shows"); + caps.Categories.AddCategoryMapping(2, NewznabStandardCategory.TV, "TV"); caps.Categories.AddCategoryMapping(3, NewznabStandardCategory.Audio, "Music"); caps.Categories.AddCategoryMapping(4, NewznabStandardCategory.BooksEBook, "ebooks"); caps.Categories.AddCategoryMapping(5, NewznabStandardCategory.TVSport, "Sports"); @@ -57,10 +59,10 @@ namespace NzbDrone.Core.Indexers.Definitions } } - public class DesiTorrentsParser : Gazelle.GazelleParser + public class DesiTorrentsParser : Unit3dParser { - public DesiTorrentsParser(GazelleSettings settings, IndexerCapabilities capabilities) - : base(settings, capabilities) + public DesiTorrentsParser(Unit3dSettings settings, IndexerCapabilitiesCategories categories) + : base(settings, categories) { } diff --git a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs index 7dcb82aaa..77c97edb4 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/UNIT3D/Unit3dParser.cs @@ -26,7 +26,7 @@ namespace NzbDrone.Core.Indexers.Definitions.UNIT3D public Action, DateTime?> CookiesUpdater { get; set; } - public IList ParseResponse(IndexerResponse indexerResponse) + public virtual IList ParseResponse(IndexerResponse indexerResponse) { var torrentInfos = new List();