mirror of
https://github.com/Jackett/Jackett
synced 2025-03-06 19:58:38 +00:00
cardigann: minor changes (#14071)
This commit is contained in:
parent
cd800b58de
commit
d3df21459e
2 changed files with 17 additions and 17 deletions
|
@ -1126,18 +1126,15 @@ namespace Jackett.Common.Indexers
|
||||||
break;
|
break;
|
||||||
case "hexdump":
|
case "hexdump":
|
||||||
// this is mainly for debugging invisible special char related issues
|
// this is mainly for debugging invisible special char related issues
|
||||||
var HexData = string.Join("", Data.Select(c => c + "(" + ((int)c).ToString("X2") + ")"));
|
var hexData = string.Join("", Data.Select(c => c + "(" + ((int)c).ToString("X2") + ")"));
|
||||||
logger.Debug(string.Format("CardigannIndexer ({0}): strdump: {1}", Id, HexData));
|
logger.Debug($"CardigannIndexer ({Id}): strdump: {hexData}");
|
||||||
break;
|
break;
|
||||||
case "strdump":
|
case "strdump":
|
||||||
// for debugging
|
// for debugging
|
||||||
var DebugData = Data.Replace("\r", "\\r").Replace("\n", "\\n").Replace("\xA0", "\\xA0");
|
var debugData = Data.Replace("\r", "\\r").Replace("\n", "\\n").Replace("\xA0", "\\xA0");
|
||||||
var strTag = (string)Filter.Args;
|
var strTag = (string)Filter.Args;
|
||||||
if (strTag != null)
|
strTag = strTag != null ? $"({strTag}):" : ":";
|
||||||
strTag = string.Format("({0}):", strTag);
|
logger.Debug($"CardigannIndexer ({Id}): strdump{strTag} {debugData}");
|
||||||
else
|
|
||||||
strTag = ":";
|
|
||||||
logger.Debug(string.Format("CardigannIndexer ({0}): strdump{1} {2}", Id, strTag, DebugData));
|
|
||||||
break;
|
break;
|
||||||
case "validate":
|
case "validate":
|
||||||
char[] delimiters = { ',', ' ', '/', ')', '(', '.', ';', '[', ']', '"', '|', ':' };
|
char[] delimiters = { ',', ' ', '/', ')', '(', '.', ';', '[', ']', '"', '|', ':' };
|
||||||
|
@ -1433,10 +1430,11 @@ namespace Jackett.Common.Indexers
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
@ -1445,14 +1443,16 @@ namespace Jackett.Common.Indexers
|
||||||
if (Search.Rows.Count != null)
|
if (Search.Rows.Count != null)
|
||||||
{
|
{
|
||||||
var countVal = handleJsonSelector(Search.Rows.Count, parsedJson, variables);
|
var countVal = handleJsonSelector(Search.Rows.Count, parsedJson, variables);
|
||||||
if (int.TryParse(countVal, out var count))
|
|
||||||
if (count < 1)
|
if (int.TryParse(countVal, out var count) && count < 1)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rowsArray = JsonParseRowsSelector(parsedJson, Search.Rows.Selector);
|
var rowsArray = JsonParseRowsSelector(parsedJson, Search.Rows.Selector);
|
||||||
|
|
||||||
if (rowsArray == null && Search.Rows.MissingAttributeEquals0Results)
|
if (rowsArray == null && Search.Rows.MissingAttributeEquals0Results)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (rowsArray == null)
|
if (rowsArray == null)
|
||||||
throw new Exception("Error Parsing Rows Selector. There are 0 rows.");
|
throw new Exception("Error Parsing Rows Selector. There are 0 rows.");
|
||||||
|
|
||||||
|
@ -2106,12 +2106,10 @@ namespace Jackett.Common.Indexers
|
||||||
value = release.DoubanId.ToString();
|
value = release.DoubanId.ToString();
|
||||||
break;
|
break;
|
||||||
case "genre":
|
case "genre":
|
||||||
if (release.Genres == null)
|
release.Genres ??= new List<string>();
|
||||||
release.Genres = new List<string>();
|
|
||||||
char[] delimiters = { ',', ' ', '/', ')', '(', '.', ';', '[', ']', '"', '|', ':' };
|
char[] delimiters = { ',', ' ', '/', ')', '(', '.', ';', '[', ']', '"', '|', ':' };
|
||||||
var releaseGenres = release.Genres.Union(value.Split(delimiters, StringSplitOptions.RemoveEmptyEntries));
|
var releaseGenres = release.Genres.Union(value.Split(delimiters, StringSplitOptions.RemoveEmptyEntries));
|
||||||
releaseGenres = releaseGenres.Select(x => x.Replace("_", " "));
|
release.Genres = releaseGenres.Select(x => x.Replace("_", " ")).ToList();
|
||||||
release.Genres = releaseGenres.ToList();
|
|
||||||
value = string.Join(",", release.Genres);
|
value = string.Join(",", release.Genres);
|
||||||
break;
|
break;
|
||||||
case "year":
|
case "year":
|
||||||
|
|
|
@ -294,13 +294,15 @@ namespace Jackett.Common.Utils
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dateTime = DateTime.ParseExact(date, pattern, CultureInfo.InvariantCulture);
|
var dateTime = DateTime.ParseExact(date, pattern, CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
if (!pattern.Contains("yy") && dateTime > now)
|
if (!pattern.Contains("yy") && dateTime > now)
|
||||||
dateTime = dateTime.AddYears(-1);
|
dateTime = dateTime.AddYears(-1);
|
||||||
|
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
catch (FormatException ex)
|
catch (FormatException ex)
|
||||||
{
|
{
|
||||||
throw new FormatException($"Error while parsing DateTime \"{date}\", using layout \"{layout}\" ({pattern}): {ex.Message}");
|
throw new FormatException($"Error while parsing DateTime \"{date}\", using layout \"{layout}\" ({pattern}): {ex.Message}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue