mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
cardigann: use MissingAttributeEqualsNoResults
for Search.Rows.Attribute
Fixes #14400
This commit is contained in:
@@ -1457,18 +1457,24 @@ namespace Jackett.Common.Indexers
|
|||||||
if (SearchPath.Response != null && SearchPath.Response.Type.Equals("json"))
|
if (SearchPath.Response != null && SearchPath.Response.Type.Equals("json"))
|
||||||
{
|
{
|
||||||
if (response.Status != HttpStatusCode.OK)
|
if (response.Status != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
throw new Exception($"Error Parsing Json Response: Status={response.Status} Response={results}");
|
throw new Exception($"Error Parsing Json Response: Status={response.Status} Response={results}");
|
||||||
|
}
|
||||||
|
|
||||||
if (response.Status == HttpStatusCode.OK
|
if (response.Status == HttpStatusCode.OK
|
||||||
&& SearchPath.Response != null
|
&& SearchPath.Response != null
|
||||||
&& SearchPath.Response.NoResultsMessage != null
|
&& SearchPath.Response.NoResultsMessage != null
|
||||||
&& (SearchPath.Response.NoResultsMessage != string.Empty && results.Contains(SearchPath.Response.NoResultsMessage) || (SearchPath.Response.NoResultsMessage == string.Empty && results == string.Empty)))
|
&& (SearchPath.Response.NoResultsMessage != string.Empty && results.Contains(SearchPath.Response.NoResultsMessage) || (SearchPath.Response.NoResultsMessage == string.Empty && results == string.Empty)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var parsedJson = JToken.Parse(results);
|
var parsedJson = JToken.Parse(results);
|
||||||
|
|
||||||
if (parsedJson == null)
|
if (parsedJson == null)
|
||||||
|
{
|
||||||
throw new Exception("Error Parsing Json Response");
|
throw new Exception("Error Parsing Json Response");
|
||||||
|
}
|
||||||
|
|
||||||
if (Search.Rows.Count != null)
|
if (Search.Rows.Count != null)
|
||||||
{
|
{
|
||||||
@@ -1492,7 +1498,9 @@ namespace Jackett.Common.Indexers
|
|||||||
if (rowsArray == null)
|
if (rowsArray == null)
|
||||||
{
|
{
|
||||||
if (Search.Rows.MissingAttributeEqualsNoResults)
|
if (Search.Rows.MissingAttributeEqualsNoResults)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
throw new Exception("Error Parsing Rows Selector. There are 0 rows.");
|
throw new Exception("Error Parsing Rows Selector. There are 0 rows.");
|
||||||
}
|
}
|
||||||
@@ -1504,7 +1512,18 @@ namespace Jackett.Common.Indexers
|
|||||||
|
|
||||||
foreach (var Row in rowsArray)
|
foreach (var Row in rowsArray)
|
||||||
{
|
{
|
||||||
var selObj = Search.Rows.Attribute != null ? Row.SelectToken(Search.Rows.Attribute).Value<JToken>() : Row;
|
var selObj = Row;
|
||||||
|
|
||||||
|
if (Search.Rows.Attribute != null)
|
||||||
|
{
|
||||||
|
selObj = Row.SelectToken(Search.Rows.Attribute)?.Value<JToken>();
|
||||||
|
|
||||||
|
if (selObj == null && Search.Rows.MissingAttributeEqualsNoResults)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var mulRows = Search.Rows.Multiple ? selObj.Values<JObject>() : new List<JObject> { selObj.Value<JObject>() };
|
var mulRows = Search.Rows.Multiple ? selObj.Values<JObject>() : new List<JObject> { selObj.Value<JObject>() };
|
||||||
|
|
||||||
foreach (var mulRow in mulRows)
|
foreach (var mulRow in mulRows)
|
||||||
|
Reference in New Issue
Block a user