mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-26 20:11:49 +02:00
Fixed: (Apps) Use forceSave=true
to avoid validation warnings
This commit is contained in:
@@ -85,13 +85,23 @@ namespace NzbDrone.Core.Applications.Lidarr
|
||||
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
try
|
||||
{
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
}
|
||||
|
||||
public LidarrIndexer UpdateIndexer(LidarrIndexer indexer, LidarrSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
@@ -179,8 +189,10 @@ namespace NzbDrone.Core.Applications.Lidarr
|
||||
break;
|
||||
default:
|
||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||
throw;
|
||||
break;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
@@ -192,8 +204,6 @@ namespace NzbDrone.Core.Applications.Lidarr
|
||||
_logger.Error(ex, "Unable to add or update indexer");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HttpRequest BuildRequest(LidarrSettings settings, string resource, HttpMethod method)
|
||||
|
@@ -86,13 +86,23 @@ namespace NzbDrone.Core.Applications.Radarr
|
||||
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
try
|
||||
{
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
}
|
||||
|
||||
public RadarrIndexer UpdateIndexer(RadarrIndexer indexer, RadarrSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
@@ -192,8 +202,10 @@ namespace NzbDrone.Core.Applications.Radarr
|
||||
break;
|
||||
default:
|
||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||
throw;
|
||||
break;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
@@ -205,8 +217,6 @@ namespace NzbDrone.Core.Applications.Radarr
|
||||
_logger.Error(ex, "Unable to add or update indexer");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HttpRequest BuildRequest(RadarrSettings settings, string resource, HttpMethod method)
|
||||
|
@@ -82,13 +82,23 @@ namespace NzbDrone.Core.Applications.Readarr
|
||||
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
try
|
||||
{
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
}
|
||||
|
||||
public ReadarrIndexer UpdateIndexer(ReadarrIndexer indexer, ReadarrSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
@@ -166,8 +176,10 @@ namespace NzbDrone.Core.Applications.Readarr
|
||||
break;
|
||||
default:
|
||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||
throw;
|
||||
break;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
@@ -179,8 +191,6 @@ namespace NzbDrone.Core.Applications.Readarr
|
||||
_logger.Error(ex, "Unable to add or update indexer");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HttpRequest BuildRequest(ReadarrSettings settings, string resource, HttpMethod method)
|
||||
|
@@ -85,13 +85,23 @@ namespace NzbDrone.Core.Applications.Sonarr
|
||||
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
try
|
||||
{
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
}
|
||||
|
||||
public SonarrIndexer UpdateIndexer(SonarrIndexer indexer, SonarrSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
@@ -185,8 +195,10 @@ namespace NzbDrone.Core.Applications.Sonarr
|
||||
break;
|
||||
default:
|
||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||
throw;
|
||||
break;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
@@ -198,8 +210,6 @@ namespace NzbDrone.Core.Applications.Sonarr
|
||||
_logger.Error(ex, "Unable to add or update indexer");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HttpRequest BuildRequest(SonarrSettings settings, string resource, HttpMethod method)
|
||||
|
@@ -82,13 +82,23 @@ namespace NzbDrone.Core.Applications.Whisparr
|
||||
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return Execute<WhisparrIndexer>(request);
|
||||
try
|
||||
{
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
catch (HttpException ex) when (ex.Response.StatusCode == HttpStatusCode.BadRequest)
|
||||
{
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
}
|
||||
}
|
||||
|
||||
public WhisparrIndexer UpdateIndexer(WhisparrIndexer indexer, WhisparrSettings settings)
|
||||
{
|
||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||
|
||||
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||
request.SetContent(indexer.ToJson());
|
||||
|
||||
return ExecuteIndexerRequest(request);
|
||||
@@ -166,8 +176,10 @@ namespace NzbDrone.Core.Applications.Whisparr
|
||||
break;
|
||||
default:
|
||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||
throw;
|
||||
break;
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
catch (JsonReaderException ex)
|
||||
{
|
||||
@@ -179,8 +191,6 @@ namespace NzbDrone.Core.Applications.Whisparr
|
||||
_logger.Error(ex, "Unable to add or update indexer");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HttpRequest BuildRequest(WhisparrSettings settings, string resource, HttpMethod method)
|
||||
|
Reference in New Issue
Block a user