Fixed: (SpeedApp) Map Categories instead of building

Fixes #574
pull/747/head
Qstick 3 years ago
parent 6e8fb22c71
commit 3fce120578

@ -61,7 +61,7 @@ namespace NzbDrone.Core.Indexers.Definitions
public override IParseIndexerResponse GetParser() public override IParseIndexerResponse GetParser()
{ {
return new SpeedAppParser(Settings); return new SpeedAppParser(Settings, Capabilities.Categories);
} }
protected override bool CheckIfLoginNeeded(HttpResponse httpResponse) protected override bool CheckIfLoginNeeded(HttpResponse httpResponse)
@ -347,13 +347,15 @@ namespace NzbDrone.Core.Indexers.Definitions
public class SpeedAppParser : IParseIndexerResponse public class SpeedAppParser : IParseIndexerResponse
{ {
public SpeedAppSettings Settings { get; set; } private readonly SpeedAppSettings _settings;
private readonly IndexerCapabilitiesCategories _categories;
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; } public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
public SpeedAppParser(SpeedAppSettings settings) public SpeedAppParser(SpeedAppSettings settings, IndexerCapabilitiesCategories categories)
{ {
Settings = settings; _settings = settings;
_categories = categories;
} }
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse) public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
@ -377,12 +379,12 @@ namespace NzbDrone.Core.Indexers.Definitions
Description = torrent.ShortDescription, Description = torrent.ShortDescription,
Size = torrent.Size, Size = torrent.Size,
ImdbId = ParseUtil.GetImdbID(torrent.ImdbId).GetValueOrDefault(), ImdbId = ParseUtil.GetImdbID(torrent.ImdbId).GetValueOrDefault(),
DownloadUrl = $"{Settings.BaseUrl}/api/torrent/{torrent.Id}/download", DownloadUrl = $"{_settings.BaseUrl}/api/torrent/{torrent.Id}/download",
PosterUrl = torrent.Poster, PosterUrl = torrent.Poster,
InfoUrl = torrent.Url, InfoUrl = torrent.Url,
Grabs = torrent.TimesCompleted, Grabs = torrent.TimesCompleted,
PublishDate = torrent.CreatedAt, PublishDate = torrent.CreatedAt,
Categories = new List<IndexerCategory> { new (torrent.Category.Id, torrent.Category.Name), }, Categories = _categories.MapTrackerCatToNewznab(torrent.Category.Id.ToString()),
InfoHash = null, InfoHash = null,
Seeders = torrent.Seeders, Seeders = torrent.Seeders,
Peers = torrent.Leechers + torrent.Seeders, Peers = torrent.Leechers + torrent.Seeders,

Loading…
Cancel
Save