mirror of https://github.com/evilhero/mylar
FIX:(#1678) When searching 32p, would use os-based dates for comparisons which caused problems when it was not English. Now will convert non-English timestamps into an English format so that comparisons will work properly again.
This commit is contained in:
parent
148533ccc2
commit
cef6732a9d
|
@ -352,7 +352,8 @@ class info32p(object):
|
||||||
'leechers': a['leechers'],
|
'leechers': a['leechers'],
|
||||||
'scanner': a['scanner'],
|
'scanner': a['scanner'],
|
||||||
'chkit': {'id': x['id'], 'series': x['series']},
|
'chkit': {'id': x['id'], 'series': x['series']},
|
||||||
'pubdate': datetime.datetime.fromtimestamp(float(a['upload_time'])).strftime('%a, %d %b %Y %H:%M:%S')})
|
'pubdate': datetime.datetime.fromtimestamp(float(a['upload_time'])).strftime('%a, %d %b %Y %H:%M:%S'),
|
||||||
|
'int_pubdate': float(a['upload_time'])})
|
||||||
|
|
||||||
|
|
||||||
if len(results32p) > 0:
|
if len(results32p) > 0:
|
||||||
|
|
|
@ -274,15 +274,15 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None):
|
||||||
tmpsz_end = tmp1 + 2
|
tmpsz_end = tmp1 + 2
|
||||||
tmpsz_st += 2
|
tmpsz_st += 2
|
||||||
|
|
||||||
if 'GB' in tmpsz[tmpsz_st:tmpsz_end]:
|
if 'KB' in tmpsz[tmpsz_st:tmpsz_end]:
|
||||||
|
szform = 'KB'
|
||||||
|
sz = 'K'
|
||||||
|
elif 'GB' in tmpsz[tmpsz_st:tmpsz_end]:
|
||||||
szform = 'GB'
|
szform = 'GB'
|
||||||
sz = 'G'
|
sz = 'G'
|
||||||
elif 'MB' in tmpsz[tmpsz_st:tmpsz_end]:
|
elif 'MB' in tmpsz[tmpsz_st:tmpsz_end]:
|
||||||
szform = 'MB'
|
szform = 'MB'
|
||||||
sz = 'M'
|
sz = 'M'
|
||||||
elif 'KB' in tmpsz[tmpsz_st:tmpsz_end]:
|
|
||||||
szform = 'KB'
|
|
||||||
sz = 'K'
|
|
||||||
elif 'TB' in tmpsz[tmpsz_st:tmpsz_end]:
|
elif 'TB' in tmpsz[tmpsz_st:tmpsz_end]:
|
||||||
szform = 'TB'
|
szform = 'TB'
|
||||||
sz = 'T'
|
sz = 'T'
|
||||||
|
|
|
@ -820,7 +820,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
|
||||||
|
|
||||||
#---- date constaints.
|
#---- date constaints.
|
||||||
# if the posting date is prior to the publication date, dump it and save the time.
|
# if the posting date is prior to the publication date, dump it and save the time.
|
||||||
#logger.info('entry' + str(entry))
|
#logger.fdebug('entry: %s' % entry)
|
||||||
if nzbprov == 'experimental' or nzbprov =='32P':
|
if nzbprov == 'experimental' or nzbprov =='32P':
|
||||||
pubdate = entry['pubdate']
|
pubdate = entry['pubdate']
|
||||||
else:
|
else:
|
||||||
|
@ -855,7 +855,20 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
|
||||||
if any([postdate_int is None, type(postdate_int) != int]) or not all([nzbprov == '32P', rss == 'no']):
|
if any([postdate_int is None, type(postdate_int) != int]) or not all([nzbprov == '32P', rss == 'no']):
|
||||||
# convert it to a tuple
|
# convert it to a tuple
|
||||||
dateconv = email.utils.parsedate_tz(pubdate)
|
dateconv = email.utils.parsedate_tz(pubdate)
|
||||||
|
if all([nzbprov == '32P', dateconv is None, rss == 'no']):
|
||||||
|
try:
|
||||||
|
pubdate = email.utils.formatdate(entry['int_pubdate'], localtime=True, usegmt=False)
|
||||||
|
except:
|
||||||
|
logger.warn('Unable to parsedate to a long-date that I can undestand : %s' % entry['int_pubdate'])
|
||||||
|
else:
|
||||||
|
logger.fdebug('Successfully converted to : %s' % pubdate)
|
||||||
|
dateconv = email.utils.parsedate_tz(pubdate)
|
||||||
|
|
||||||
|
try:
|
||||||
dateconv2 = datetime.datetime(*dateconv[:6])
|
dateconv2 = datetime.datetime(*dateconv[:6])
|
||||||
|
except TypeError as e:
|
||||||
|
logger.warn('Unable to convert timestamp from : %s [%s]' % ((dateconv,), e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# convert it to a numeric time, then subtract the timezone difference (+/- GMT)
|
# convert it to a numeric time, then subtract the timezone difference (+/- GMT)
|
||||||
if dateconv[-1] is not None:
|
if dateconv[-1] is not None:
|
||||||
|
|
Loading…
Reference in New Issue