Skip to content

Commit

Permalink
Fixed: Convert DesiTorrents to Gazelle
Browse files Browse the repository at this point in the history
Fixes #220
  • Loading branch information
Qstick committed Aug 31, 2021
1 parent b4f8fb7 commit e4ef1c3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, I
"beyond-hd",
"beyond-hd-oneurl",
"danishbytes",
"desitorrents",
"hdbits",
"shareisland"
};
Expand Down
80 changes: 80 additions & 0 deletions src/NzbDrone.Core/Indexers/Definitions/DesiTorrents.cs
Original file line number Diff line number Diff line change
@@ -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>
{
TvSearchParam.Q, TvSearchParam.Season, TvSearchParam.Ep
},
MovieSearchParams = new List<MovieSearchParam>
{
MovieSearchParam.Q
},
MusicSearchParams = new List<MusicSearchParam>
{
MusicSearchParam.Q
},
BookSearchParams = new List<BookSearchParam>
{
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<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
{
var releases = base.ParseResponse(indexerResponse);

foreach (TorrentInfo release in releases)
{
release.MinimumRatio = 0.6;
release.MinimumSeedTime = 259200;
}

return releases;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public GazelleParser(GazelleSettings settings, IndexerCapabilities capabilities)

public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }

public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
public virtual IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
{
var torrentInfos = new List<ReleaseInfo>();

Expand Down

0 comments on commit e4ef1c3

Please sign in to comment.