@ -144,9 +144,9 @@ namespace Prowlarr.Api.V1.Search
request . QueryToParams ( ) ;
request . QueryToParams ( ) ;
var result = await _nzbSearhService . Search ( request , payload . IndexerIds , true ) ;
var result = await _nzbSearhService . Search ( request , payload . IndexerIds , true ) ;
var decision s = result . Releases ;
var release s = result . Releases ;
return Map Decisions( decision s, Request . GetServerUrl ( ) ) ;
return Map Releases( release s, Request . GetServerUrl ( ) ) ;
}
}
catch ( SearchFailedException ex )
catch ( SearchFailedException ex )
{
{
@ -160,15 +160,15 @@ namespace Prowlarr.Api.V1.Search
return new List < ReleaseResource > ( ) ;
return new List < ReleaseResource > ( ) ;
}
}
protected virtual List < ReleaseResource > Map Decision s( IEnumerable < ReleaseInfo > releases , string serverUrl )
protected virtual List < ReleaseResource > Map Release s( IEnumerable < ReleaseInfo > releases , string serverUrl )
{
{
var result = new List < ReleaseResource > ( ) ;
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 . 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 ;
release . MagnetUrl = release . MagnetUrl . IsNotNullOrWhiteSpace ( ) ? _downloadMappingService . ConvertToProxyLink ( new Uri ( release . MagnetUrl ) , serverUrl , release . IndexerId , release . Title ) . AbsoluteUri : null ;