cardigann: switch to standard datetime format (#14072)

This commit is contained in:
Bogdan 2023-02-24 00:28:03 +02:00 committed by GitHub
parent 37fb4b32f0
commit 4f9b2210e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 51 additions and 43 deletions

View File

@ -158,7 +158,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -143,7 +143,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -143,7 +143,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -131,7 +131,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -137,7 +137,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -141,7 +141,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -124,7 +124,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -144,7 +144,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -137,7 +137,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -177,7 +177,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -120,7 +120,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -123,7 +123,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -165,7 +165,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -131,7 +131,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -160,7 +160,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -129,7 +129,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -134,7 +134,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -147,7 +147,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -153,7 +153,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -163,7 +163,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -136,7 +136,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -172,7 +172,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -132,7 +132,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -132,7 +132,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -131,7 +131,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -133,7 +133,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -183,7 +183,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -142,7 +142,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -119,7 +119,7 @@ search:
- name: append
args: " +00:00" # GMT
- name: dateparse
args: "01/02/2006 15:04:05 -07:00"
args: "MM/dd/yyyy HH:mm:ss zzz"
size:
selector: size
downloadvolumefactor:

View File

@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
@ -1011,14 +1012,20 @@ namespace Jackett.Common.Indexers
case "timeparse":
case "dateparse":
var layout = (string)Filter.Args;
try
if (layout.Contains("yy") && DateTime.TryParseExact(Data, layout, CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate))
Data = parsedDate.ToString(DateTimeUtil.Rfc1123ZPattern);
else
{
var Date = DateTimeUtil.ParseDateTimeGoLang(Data, layout);
Data = Date.ToString(DateTimeUtil.Rfc1123ZPattern);
}
catch (FormatException ex)
{
logger.Debug(ex.Message);
try
{
var datetime = DateTimeUtil.ParseDateTimeGoLang(Data, layout);
Data = datetime.ToString(DateTimeUtil.Rfc1123ZPattern);
}
catch (FormatException ex)
{
logger.Debug(ex.Message);
}
}
break;
case "regexp":
@ -1436,7 +1443,9 @@ namespace Jackett.Common.Indexers
&& SearchPath.Response.NoResultsMessage != null
&& (SearchPath.Response.NoResultsMessage != string.Empty && results.Contains(SearchPath.Response.NoResultsMessage) || (SearchPath.Response.NoResultsMessage == string.Empty && results == string.Empty)))
continue;
var parsedJson = JToken.Parse(results);
if (parsedJson == null)
throw new Exception("Error Parsing Json Response");

View File

@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
namespace Jackett.Common.Utils
@ -114,6 +115,11 @@ namespace Jackett.Common.Utils
{
str = ParseUtil.NormalizeSpace(str);
var now = relativeFrom ?? DateTime.Now;
// try parsing the str as an unix timestamp
if (str.All(char.IsDigit) && long.TryParse(str, out var unixTimeStamp))
return UnixTimestampToDateTime(unixTimeStamp);
if (str.ToLower().Contains("now"))
return now;
@ -187,13 +193,6 @@ namespace Jackett.Common.Utils
return dt;
}
// try parsing the str as an unix timestamp
if (long.TryParse(str, out var unixTimeStamp))
{
return UnixTimestampToDateTime(unixTimeStamp);
}
// it wasn't a timestamp, continue....
// add missing year
match = _MissingYearRegexp.Match(str);
if (match.Success)