Rename decisions to releases in Search Controller

pull/1787/head
Bogdan 1 year ago
parent 1a66d23bfe
commit 37a4e7c228

@ -60,7 +60,7 @@ namespace Prowlarr.Api.V1.Search
public static ReleaseResource ToResource(this ReleaseInfo model)
{
var releaseInfo = model;
var torrentInfo = (model as TorrentInfo) ?? new TorrentInfo();
var torrentInfo = model as TorrentInfo ?? new TorrentInfo();
var indexerFlags = torrentInfo.IndexerFlags.Select(f => f.Name);
// TODO: Clean this mess up. don't mix data from multiple classes, use sub-resources instead? (Got a huge Deja Vu, didn't we talk about this already once?)

@ -144,9 +144,9 @@ namespace Prowlarr.Api.V1.Search
request.QueryToParams();
var result = await _nzbSearhService.Search(request, payload.IndexerIds, true);
var decisions = result.Releases;
var releases = result.Releases;
return MapDecisions(decisions, Request.GetServerUrl());
return MapReleases(releases, Request.GetServerUrl());
}
catch (SearchFailedException ex)
{
@ -160,15 +160,15 @@ namespace Prowlarr.Api.V1.Search
return new List<ReleaseResource>();
}
protected virtual List<ReleaseResource> MapDecisions(IEnumerable<ReleaseInfo> releases, string serverUrl)
protected virtual List<ReleaseResource> MapReleases(IEnumerable<ReleaseInfo> releases, string serverUrl)
{
var result = new List<ReleaseResource>();
foreach (var downloadDecision in releases)
foreach (var releaseInfo in releases)
{
var release = downloadDecision.ToResource();
var release = releaseInfo.ToResource();
_remoteReleaseCache.Set(GetCacheKey(release), downloadDecision, TimeSpan.FromMinutes(30));
_remoteReleaseCache.Set(GetCacheKey(release), releaseInfo, TimeSpan.FromMinutes(30));
release.DownloadUrl = release.DownloadUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(release.DownloadUrl), serverUrl, release.IndexerId, release.Title).AbsoluteUri : null;
release.MagnetUrl = release.MagnetUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(release.MagnetUrl), serverUrl, release.IndexerId, release.Title).AbsoluteUri : null;

Loading…
Cancel
Save