Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2370153192 | ||
|
|
79ad4f9370 | ||
|
|
d70ae41951 | ||
|
|
2650d32ae2 | ||
|
|
5f87a596fb | ||
|
|
c2b200f3be | ||
|
|
6ef8cc3cd1 | ||
|
|
02cf2854e1 | ||
|
|
22ecdaa6cd |
@@ -56,6 +56,8 @@ namespace UmlautAdaptarr.Controllers
|
||||
queryParameters.Remove("tvdbid");
|
||||
queryParameters.Remove("tvmazeid");
|
||||
queryParameters.Remove("imdbid");
|
||||
queryParameters.Remove("rid");
|
||||
queryParameters.Remove("tmdbid");
|
||||
|
||||
var titleSearchVariations = new List<string>(searchItem?.TitleSearchVariations);
|
||||
|
||||
|
||||
@@ -21,9 +21,7 @@ namespace UmlautAdaptarr.Controllers
|
||||
if (string.IsNullOrWhiteSpace(changedTitle))
|
||||
return BadRequest("changedTitle is required.");
|
||||
|
||||
var cleanChangedTitle = changedTitle.Replace(":", "-");
|
||||
|
||||
var originalTitle = cacheService.GetOriginalTitleFromRenamed(cleanChangedTitle);
|
||||
var originalTitle = cacheService.GetOriginalTitleFromRenamed(changedTitle);
|
||||
|
||||
return originalTitle != null
|
||||
? Ok(new { changedTitle, originalTitle })
|
||||
|
||||
@@ -202,6 +202,13 @@ namespace UmlautAdaptarr.Services
|
||||
|
||||
var key = $"{TitleRenamePrefix}{changedTitle.Trim().ToLowerInvariant()}";
|
||||
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)
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace UmlautAdaptarr.Services
|
||||
}
|
||||
|
||||
await EnsureMinimumDelayAsync(targetUri);
|
||||
var targetHost = new Uri(targetUri).Host;
|
||||
|
||||
var requestMessage = new HttpRequestMessage
|
||||
{
|
||||
@@ -88,7 +89,14 @@ namespace UmlautAdaptarr.Services
|
||||
}
|
||||
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)
|
||||
{
|
||||
@@ -97,5 +105,26 @@ namespace UmlautAdaptarr.Services
|
||||
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
|
||||
|
||||
### 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__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.
|
||||
#- Kestrel__Endpoints__Http__Url=http://[::]:5005 # HTTP port for the UmlautAdaptarr
|
||||
|
||||
#- IpLeakTest__Enabled=false
|
||||
|
||||
Reference in New Issue
Block a user