mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 13:57:11 -04:00
Fixed: (Apps) Use forceSave=true
to avoid validation warnings
This commit is contained in:
parent
8fcceb0702
commit
06391489cf
5 changed files with 70 additions and 20 deletions
|
@ -85,13 +85,23 @@ namespace NzbDrone.Core.Applications.Lidarr
|
||||||
|
|
||||||
request.SetContent(indexer.ToJson());
|
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)
|
public LidarrIndexer UpdateIndexer(LidarrIndexer indexer, LidarrSettings settings)
|
||||||
{
|
{
|
||||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||||
|
|
||||||
|
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||||
request.SetContent(indexer.ToJson());
|
request.SetContent(indexer.ToJson());
|
||||||
|
|
||||||
return ExecuteIndexerRequest(request);
|
return ExecuteIndexerRequest(request);
|
||||||
|
@ -179,8 +189,10 @@ namespace NzbDrone.Core.Applications.Lidarr
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||||
throw;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
catch (JsonReaderException ex)
|
catch (JsonReaderException ex)
|
||||||
{
|
{
|
||||||
|
@ -192,8 +204,6 @@ namespace NzbDrone.Core.Applications.Lidarr
|
||||||
_logger.Error(ex, "Unable to add or update indexer");
|
_logger.Error(ex, "Unable to add or update indexer");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpRequest BuildRequest(LidarrSettings settings, string resource, HttpMethod method)
|
private HttpRequest BuildRequest(LidarrSettings settings, string resource, HttpMethod method)
|
||||||
|
|
|
@ -86,13 +86,23 @@ namespace NzbDrone.Core.Applications.Radarr
|
||||||
|
|
||||||
request.SetContent(indexer.ToJson());
|
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)
|
public RadarrIndexer UpdateIndexer(RadarrIndexer indexer, RadarrSettings settings)
|
||||||
{
|
{
|
||||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||||
|
|
||||||
|
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||||
request.SetContent(indexer.ToJson());
|
request.SetContent(indexer.ToJson());
|
||||||
|
|
||||||
return ExecuteIndexerRequest(request);
|
return ExecuteIndexerRequest(request);
|
||||||
|
@ -192,8 +202,10 @@ namespace NzbDrone.Core.Applications.Radarr
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||||
throw;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
catch (JsonReaderException ex)
|
catch (JsonReaderException ex)
|
||||||
{
|
{
|
||||||
|
@ -205,8 +217,6 @@ namespace NzbDrone.Core.Applications.Radarr
|
||||||
_logger.Error(ex, "Unable to add or update indexer");
|
_logger.Error(ex, "Unable to add or update indexer");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpRequest BuildRequest(RadarrSettings settings, string resource, HttpMethod method)
|
private HttpRequest BuildRequest(RadarrSettings settings, string resource, HttpMethod method)
|
||||||
|
|
|
@ -82,13 +82,23 @@ namespace NzbDrone.Core.Applications.Readarr
|
||||||
|
|
||||||
request.SetContent(indexer.ToJson());
|
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)
|
public ReadarrIndexer UpdateIndexer(ReadarrIndexer indexer, ReadarrSettings settings)
|
||||||
{
|
{
|
||||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||||
|
|
||||||
|
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||||
request.SetContent(indexer.ToJson());
|
request.SetContent(indexer.ToJson());
|
||||||
|
|
||||||
return ExecuteIndexerRequest(request);
|
return ExecuteIndexerRequest(request);
|
||||||
|
@ -166,8 +176,10 @@ namespace NzbDrone.Core.Applications.Readarr
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||||
throw;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
catch (JsonReaderException ex)
|
catch (JsonReaderException ex)
|
||||||
{
|
{
|
||||||
|
@ -179,8 +191,6 @@ namespace NzbDrone.Core.Applications.Readarr
|
||||||
_logger.Error(ex, "Unable to add or update indexer");
|
_logger.Error(ex, "Unable to add or update indexer");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpRequest BuildRequest(ReadarrSettings settings, string resource, HttpMethod method)
|
private HttpRequest BuildRequest(ReadarrSettings settings, string resource, HttpMethod method)
|
||||||
|
|
|
@ -85,13 +85,23 @@ namespace NzbDrone.Core.Applications.Sonarr
|
||||||
|
|
||||||
request.SetContent(indexer.ToJson());
|
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)
|
public SonarrIndexer UpdateIndexer(SonarrIndexer indexer, SonarrSettings settings)
|
||||||
{
|
{
|
||||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||||
|
|
||||||
|
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||||
request.SetContent(indexer.ToJson());
|
request.SetContent(indexer.ToJson());
|
||||||
|
|
||||||
return ExecuteIndexerRequest(request);
|
return ExecuteIndexerRequest(request);
|
||||||
|
@ -185,8 +195,10 @@ namespace NzbDrone.Core.Applications.Sonarr
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||||
throw;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
catch (JsonReaderException ex)
|
catch (JsonReaderException ex)
|
||||||
{
|
{
|
||||||
|
@ -198,8 +210,6 @@ namespace NzbDrone.Core.Applications.Sonarr
|
||||||
_logger.Error(ex, "Unable to add or update indexer");
|
_logger.Error(ex, "Unable to add or update indexer");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpRequest BuildRequest(SonarrSettings settings, string resource, HttpMethod method)
|
private HttpRequest BuildRequest(SonarrSettings settings, string resource, HttpMethod method)
|
||||||
|
|
|
@ -82,13 +82,23 @@ namespace NzbDrone.Core.Applications.Whisparr
|
||||||
|
|
||||||
request.SetContent(indexer.ToJson());
|
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)
|
public WhisparrIndexer UpdateIndexer(WhisparrIndexer indexer, WhisparrSettings settings)
|
||||||
{
|
{
|
||||||
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
var request = BuildRequest(settings, $"{AppIndexerApiRoute}/{indexer.Id}", HttpMethod.Put);
|
||||||
|
|
||||||
|
request.Url = request.Url.AddQueryParam("forceSave", "true");
|
||||||
request.SetContent(indexer.ToJson());
|
request.SetContent(indexer.ToJson());
|
||||||
|
|
||||||
return ExecuteIndexerRequest(request);
|
return ExecuteIndexerRequest(request);
|
||||||
|
@ -166,8 +176,10 @@ namespace NzbDrone.Core.Applications.Whisparr
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
_logger.Error(ex, "Unexpected response status code: {0}", ex.Response.StatusCode);
|
||||||
throw;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
catch (JsonReaderException ex)
|
catch (JsonReaderException ex)
|
||||||
{
|
{
|
||||||
|
@ -179,8 +191,6 @@ namespace NzbDrone.Core.Applications.Whisparr
|
||||||
_logger.Error(ex, "Unable to add or update indexer");
|
_logger.Error(ex, "Unable to add or update indexer");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpRequest BuildRequest(WhisparrSettings settings, string resource, HttpMethod method)
|
private HttpRequest BuildRequest(WhisparrSettings settings, string resource, HttpMethod method)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue