Skip to content

Commit

Permalink
Fixed: (GGn) Don't die on invalid FreeTorrent values in the API
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Feb 18, 2024
1 parent 15c6b3c commit 8c653b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/NzbDrone.Core/Indexers/Definitions/GazelleGames.cs
Expand Up @@ -412,6 +412,8 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
categories = _categories.MapTrackerCatToNewznab(torrent.Value.CategoryId.ToString()).ToArray();
}

Enum.TryParse(torrent.Value.FreeTorrent, true, out GazelleGamesFreeTorrent freeTorrent);

var release = new TorrentInfo
{
Guid = infoUrl,
Expand All @@ -426,8 +428,8 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
Peers = torrent.Value.Leechers + torrent.Value.Seeders,
PublishDate = torrent.Value.Time.ToUniversalTime(),
Scene = torrent.Value.Scene == 1,
DownloadVolumeFactor = torrent.Value.FreeTorrent is GazelleGamesFreeTorrent.FreeLeech or GazelleGamesFreeTorrent.Neutral || torrent.Value.LowSeedFL ? 0 : 1,
UploadVolumeFactor = torrent.Value.FreeTorrent == GazelleGamesFreeTorrent.Neutral ? 0 : 1,
DownloadVolumeFactor = freeTorrent is GazelleGamesFreeTorrent.FreeLeech or GazelleGamesFreeTorrent.Neutral || torrent.Value.LowSeedFL ? 0 : 1,
UploadVolumeFactor = freeTorrent == GazelleGamesFreeTorrent.Neutral ? 0 : 1,
MinimumSeedTime = 288000 // Minimum of 3 days and 8 hours (80 hours in total)
};

Expand Down Expand Up @@ -588,7 +590,7 @@ public class GazelleGamesTorrent
public int? Snatched { get; set; }
public int Seeders { get; set; }
public int Leechers { get; set; }
public GazelleGamesFreeTorrent FreeTorrent { get; set; }
public string FreeTorrent { get; set; }
public bool PersonalFL { get; set; }
public bool LowSeedFL { get; set; }

Expand Down

0 comments on commit 8c653b5

Please sign in to comment.