mirror of https://github.com/Jackett/Jackett
cardigann: switch to standard datetime format (#14072)
This commit is contained in:
parent
37fb4b32f0
commit
4f9b2210e1
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue