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:
evilhero 2017-07-13 14:03:32 -04:00
parent 148533ccc2
commit cef6732a9d
3 changed files with 21 additions and 7 deletions

View File

@ -352,7 +352,8 @@ class info32p(object):
'leechers': a['leechers'],
'scanner': a['scanner'],
'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:

View File

@ -274,15 +274,15 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None):
tmpsz_end = tmp1 + 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'
sz = 'G'
elif 'MB' in tmpsz[tmpsz_st:tmpsz_end]:
szform = 'MB'
sz = 'M'
elif 'KB' in tmpsz[tmpsz_st:tmpsz_end]:
szform = 'KB'
sz = 'K'
elif 'TB' in tmpsz[tmpsz_st:tmpsz_end]:
szform = 'TB'
sz = 'T'

View File

@ -820,7 +820,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
#---- date constaints.
# 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':
pubdate = entry['pubdate']
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']):
# convert it to a tuple
dateconv = email.utils.parsedate_tz(pubdate)
dateconv2 = datetime.datetime(*dateconv[:6])
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])
except TypeError as e:
logger.warn('Unable to convert timestamp from : %s [%s]' % ((dateconv,), e))
try:
# convert it to a numeric time, then subtract the timezone difference (+/- GMT)
if dateconv[-1] is not None: