From 37a4e7c2284ee0bc04c54b4f08fcb1ea8ae97c56 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 20 Jul 2023 19:25:04 +0300 Subject: [PATCH] Rename decisions to releases in Search Controller --- src/Prowlarr.Api.V1/Search/ReleaseResource.cs | 2 +- src/Prowlarr.Api.V1/Search/SearchController.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Prowlarr.Api.V1/Search/ReleaseResource.cs b/src/Prowlarr.Api.V1/Search/ReleaseResource.cs index 04d899483..49364f445 100644 --- a/src/Prowlarr.Api.V1/Search/ReleaseResource.cs +++ b/src/Prowlarr.Api.V1/Search/ReleaseResource.cs @@ -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?) diff --git a/src/Prowlarr.Api.V1/Search/SearchController.cs b/src/Prowlarr.Api.V1/Search/SearchController.cs index 7b81df58f..9f24175c0 100644 --- a/src/Prowlarr.Api.V1/Search/SearchController.cs +++ b/src/Prowlarr.Api.V1/Search/SearchController.cs @@ -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(); } - protected virtual List MapDecisions(IEnumerable releases, string serverUrl) + protected virtual List MapReleases(IEnumerable releases, string serverUrl) { var result = new List(); - 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;