Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2370153192 | ||
|
|
79ad4f9370 | ||
|
|
d70ae41951 | ||
|
|
2650d32ae2 | ||
|
|
5f87a596fb | ||
|
|
c2b200f3be | ||
|
|
6ef8cc3cd1 | ||
|
|
b94c6bc6ad | ||
|
|
feae0ca309 | ||
|
|
b828b64a22 | ||
|
|
02cf2854e1 | ||
|
|
22ecdaa6cd |
@@ -13,7 +13,7 @@ namespace UmlautAdaptarr.Controllers
|
|||||||
// TODO evaluate if this should be set to true by default
|
// TODO evaluate if this should be set to true by default
|
||||||
private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = true;
|
private readonly bool TODO_FORCE_TEXT_SEARCH_ORIGINAL_TITLE = true;
|
||||||
private readonly bool TODO_FORCE_TEXT_SEARCH_GERMAN_TITLE = false;
|
private readonly bool TODO_FORCE_TEXT_SEARCH_GERMAN_TITLE = false;
|
||||||
protected async Task<IActionResult> BaseSearch(string apiKey,
|
protected async Task<IActionResult?> BaseSearch(string apiKey,
|
||||||
string domain,
|
string domain,
|
||||||
IDictionary<string, string> queryParameters,
|
IDictionary<string, string> queryParameters,
|
||||||
SearchItem? searchItem = null)
|
SearchItem? searchItem = null)
|
||||||
@@ -30,8 +30,7 @@ namespace UmlautAdaptarr.Controllers
|
|||||||
return NotFound($"{domain} is not a valid URL.");
|
return NotFound($"{domain} is not a valid URL.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentResult? initialSearchResult = await PerformSingleSearchRequest(domain, queryParameters) as ContentResult;
|
if (await PerformSingleSearchRequest(domain, queryParameters) is not ContentResult initialSearchResult)
|
||||||
if (initialSearchResult == null)
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -57,6 +56,8 @@ namespace UmlautAdaptarr.Controllers
|
|||||||
queryParameters.Remove("tvdbid");
|
queryParameters.Remove("tvdbid");
|
||||||
queryParameters.Remove("tvmazeid");
|
queryParameters.Remove("tvmazeid");
|
||||||
queryParameters.Remove("imdbid");
|
queryParameters.Remove("imdbid");
|
||||||
|
queryParameters.Remove("rid");
|
||||||
|
queryParameters.Remove("tmdbid");
|
||||||
|
|
||||||
var titleSearchVariations = new List<string>(searchItem?.TitleSearchVariations);
|
var titleSearchVariations = new List<string>(searchItem?.TitleSearchVariations);
|
||||||
|
|
||||||
|
|||||||
@@ -202,6 +202,13 @@ namespace UmlautAdaptarr.Services
|
|||||||
|
|
||||||
var key = $"{TitleRenamePrefix}{changedTitle.Trim().ToLowerInvariant()}";
|
var key = $"{TitleRenamePrefix}{changedTitle.Trim().ToLowerInvariant()}";
|
||||||
cache.Set(key, originalTitle, TitleRenameCacheDuration);
|
cache.Set(key, originalTitle, TitleRenameCacheDuration);
|
||||||
|
|
||||||
|
// If title contains ":" also add it as "-" for arr/sabnzbd compatibility
|
||||||
|
if (changedTitle.Contains(':'))
|
||||||
|
{
|
||||||
|
var altKey = $"{TitleRenamePrefix}{changedTitle.Replace(':', '-').Trim().ToLowerInvariant()}";
|
||||||
|
cache.Set(altKey, originalTitle, TitleRenameCacheDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string? GetOriginalTitleFromRenamed(string changedTitle)
|
public string? GetOriginalTitleFromRenamed(string changedTitle)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace UmlautAdaptarr.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
await EnsureMinimumDelayAsync(targetUri);
|
await EnsureMinimumDelayAsync(targetUri);
|
||||||
|
var targetHost = new Uri(targetUri).Host;
|
||||||
|
|
||||||
var requestMessage = new HttpRequestMessage
|
var requestMessage = new HttpRequestMessage
|
||||||
{
|
{
|
||||||
@@ -88,7 +89,14 @@ namespace UmlautAdaptarr.Services
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, $"Error proxying request: {UrlUtilities.RedactApiKey(targetUri)}. Error: {ex.Message}");
|
var upstreamMessage = IsTimeoutOrReset(ex)
|
||||||
|
? $"{targetHost} timed out or reset the connection. This is an error with your indexer or network, not with UmlautAdaptarr."
|
||||||
|
: $"{targetHost} request failed. This is an error with your indexer or network, not with UmlautAdaptarr.";
|
||||||
|
|
||||||
|
_logger.LogError(ex, "{UpstreamMessage} Target: {TargetUri} Error: {ErrorMessage}",
|
||||||
|
upstreamMessage,
|
||||||
|
UrlUtilities.RedactApiKey(targetUri),
|
||||||
|
ex.Message);
|
||||||
|
|
||||||
var errorResponse = new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)
|
var errorResponse = new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)
|
||||||
{
|
{
|
||||||
@@ -97,5 +105,26 @@ namespace UmlautAdaptarr.Services
|
|||||||
return errorResponse;
|
return errorResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsTimeoutOrReset(Exception ex)
|
||||||
|
{
|
||||||
|
if (ex is TaskCanceledException)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var current = ex;
|
||||||
|
while (current != null)
|
||||||
|
{
|
||||||
|
if (current is System.Net.Sockets.SocketException socketEx)
|
||||||
|
{
|
||||||
|
return socketEx.SocketErrorCode == System.Net.Sockets.SocketError.TimedOut
|
||||||
|
|| socketEx.SocketErrorCode == System.Net.Sockets.SocketError.ConnectionReset;
|
||||||
|
}
|
||||||
|
current = current.InnerException;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ services:
|
|||||||
#- SONARR__1__APIKEY=APIKEY
|
#- SONARR__1__APIKEY=APIKEY
|
||||||
|
|
||||||
### Advanced options (with default values))
|
### Advanced options (with default values))
|
||||||
#- IpLeakTest__Enabled=false
|
#- SETTINGS__EnableChangedTitleCache=false # Enables the changed title API under /titlelookup?changedTitle=$title - enable if you are using crowdnfo.net post processing script.
|
||||||
#- SETTINGS__IndexerRequestsCacheDurationInMinutes=12 # How long to cache indexer requests for. Default is 12 minutes.
|
#- SETTINGS__IndexerRequestsCacheDurationInMinutes=12 # How long to cache indexer requests for. Default is 12 minutes.
|
||||||
#- SETTINGS__ApiKey= # API key for requests to the UmlautAdaptarr. Optional, probably only needed for seedboxes.
|
#- SETTINGS__ApiKey= # API key for requests to the UmlautAdaptarr. Optional, probably only needed for seedboxes.
|
||||||
#- SETTINGS__ProxyPort=5006 # Proxy port for the internal UmlautAdaptarr proxy used for Prowlarr.
|
#- SETTINGS__ProxyPort=5006 # Proxy port for the internal UmlautAdaptarr proxy used for Prowlarr.
|
||||||
#- Kestrel__Endpoints__Http__Url=http://[::]:5005 # HTTP port for the UmlautAdaptarr
|
#- Kestrel__Endpoints__Http__Url=http://[::]:5005 # HTTP port for the UmlautAdaptarr
|
||||||
|
#- IpLeakTest__Enabled=false
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export LIDARR__APIKEY=APIKEY
|
|||||||
# Advanced Options
|
# Advanced Options
|
||||||
#export IpLeakTest__Enabled=false
|
#export IpLeakTest__Enabled=false
|
||||||
#export SETTINGS__IndexerRequestsCacheDurationInMinutes=12
|
#export SETTINGS__IndexerRequestsCacheDurationInMinutes=12
|
||||||
|
export ASPNETCORE_CONTENTROOT="./publish"
|
||||||
export SETTINGS__ApiKey="apikey" # Change to something unique! Then in Prowlarr, in the proxy settings set any username and use this ApiKey as password.
|
export SETTINGS__ApiKey="apikey" # Change to something unique! Then in Prowlarr, in the proxy settings set any username and use this ApiKey as password.
|
||||||
export SETTINGS__ProxyPort=1234 # Port for Proxy
|
export SETTINGS__ProxyPort=1234 # Port for Proxy
|
||||||
export Kestrel__Endpoints__Http__Url="http://[::]:1235" # Port for UmlautAdaptarr API
|
export Kestrel__Endpoints__Http__Url="http://[::]:1235" # Port for UmlautAdaptarr API
|
||||||
|
|||||||
Reference in New Issue
Block a user