1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-01-03 05:44:50 +00:00

Fallback to text searches for FL only if year is defined

This commit is contained in:
Bogdan 2024-10-21 09:52:55 +03:00
parent dd90bf53dd
commit abf1b9d6cf

View file

@ -26,14 +26,14 @@ public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria
if (searchCriteria.Movie.MovieMetadata.Value.ImdbId.IsNotNullOrWhiteSpace())
{
pageableRequests.Add(GetRequest("search-torrents", string.Format("&type=imdb&query={0}", searchCriteria.Movie.MovieMetadata.Value.ImdbId)));
pageableRequests.Add(GetRequest("search-torrents", $"&type=imdb&query={searchCriteria.Movie.MovieMetadata.Value.ImdbId}"));
}
else
else if (searchCriteria.Movie.Year > 0)
{
foreach (var queryTitle in searchCriteria.CleanSceneTitles)
{
var titleYearSearchQuery = string.Format("{0}+{1}", queryTitle, searchCriteria.Movie.Year);
pageableRequests.Add(GetRequest("search-torrents", string.Format("&type=name&query={0}", titleYearSearchQuery.Trim())));
var titleYearSearchQuery = $"{queryTitle}+{searchCriteria.Movie.Year}";
pageableRequests.Add(GetRequest("search-torrents", $"&type=name&query={titleYearSearchQuery.Trim()}"));
}
}
@ -44,7 +44,7 @@ private IEnumerable<IndexerRequest> GetRequest(string searchType, string paramet
{
var categoriesQuery = string.Join(",", Settings.Categories.Distinct());
var baseUrl = string.Format("{0}/api.php?action={1}&category={2}{3}", Settings.BaseUrl.TrimEnd('/'), searchType, categoriesQuery, parameters);
var baseUrl = $"{Settings.BaseUrl.TrimEnd('/')}/api.php?action={searchType}&category={categoriesQuery}{parameters}";
var request = new IndexerRequest(baseUrl, HttpAccept.Json);
request.HttpRequest.Credentials = new BasicNetworkCredential(Settings.Username.Trim(), Settings.Passkey.Trim());