diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs index 48be951d2..3aa5ec297 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs @@ -52,6 +52,8 @@ public virtual IList ParseResponse(IndexerResponse indexerResponse) foreach (var result in jsonResponse.Resource.Response.Results) { + var posterUrl = GetPosterUrl(result.Cover); + if (result.Torrents != null) { foreach (var torrent in result.Torrents) @@ -66,9 +68,11 @@ public virtual IList ParseResponse(IndexerResponse indexerResponse) title += " [Cue]"; } + var infoUrl = GetInfoUrl(result.GroupId, id); + var release = new GazelleInfo() { - Guid = string.Format("Gazelle-{0}", id), + Guid = infoUrl, Title = WebUtility.HtmlDecode(title), Container = torrent.Encoding, Files = torrent.FileCount, @@ -76,11 +80,12 @@ public virtual IList ParseResponse(IndexerResponse indexerResponse) Codec = torrent.Format, Size = long.Parse(torrent.Size), DownloadUrl = GetDownloadUrl(id), - InfoUrl = GetInfoUrl(result.GroupId, id), + InfoUrl = infoUrl, Seeders = int.Parse(torrent.Seeders), Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders), PublishDate = torrent.Time.ToUniversalTime(), Scene = torrent.Scene, + PosterUrl = posterUrl }; var category = torrent.Category; @@ -100,19 +105,21 @@ public virtual IList ParseResponse(IndexerResponse indexerResponse) { var id = result.TorrentId; var groupName = WebUtility.HtmlDecode(result.GroupName); + var infoUrl = GetInfoUrl(result.GroupId, id); var release = new GazelleInfo() { - Guid = string.Format("Gazelle-{0}", id), + Guid = infoUrl, Title = groupName, Size = long.Parse(result.Size), DownloadUrl = GetDownloadUrl(id), - InfoUrl = GetInfoUrl(result.GroupId, id), + InfoUrl = infoUrl, Seeders = int.Parse(result.Seeders), Peers = int.Parse(result.Leechers) + int.Parse(result.Seeders), Files = result.FileCount, Grabs = result.Snatches, PublishDate = DateTimeOffset.FromUnixTimeSeconds(result.GroupTime).UtcDateTime, + PosterUrl = posterUrl }; var category = result.Category; @@ -147,7 +154,19 @@ protected virtual string GetDownloadUrl(int torrentId) return url.FullUri; } - private string GetInfoUrl(string groupId, int torrentId) + protected virtual string GetPosterUrl(string cover) + { + if (!string.IsNullOrEmpty(cover)) + { + return cover.StartsWith("http") ? + new HttpUri(cover).FullUri : + new HttpUri(_settings.BaseUrl).CombinePath(cover).FullUri; + } + + return null; + } + + protected virtual string GetInfoUrl(string groupId, int torrentId) { var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php")