FIX:(#1667) 32p api searches returned invalid timestamps when OS being used has a different long-date format than expected, FIX: Public torrent searches would error due to size of torrent being in KB instead of expected MB,GB (added TB acceptance as well)

This commit is contained in:
evilhero 2017-07-09 14:51:54 -04:00
parent f9b08c6da6
commit e48ff520a1
2 changed files with 14 additions and 3 deletions

View File

@ -352,7 +352,7 @@ 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('%c')})
'pubdate': datetime.datetime.fromtimestamp(float(a['upload_time'])).strftime('%a, %d %b %Y %H:%M:%S')})
if len(results32p) > 0:

View File

@ -248,24 +248,29 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None):
tmpsz_st = tmpsz.find('Size')
if tmpsz_st != -1:
tmpsize = tmpsz[tmpsz_st:tmpsz_st+14]
if any(['GB' in tmpsize, 'MB' in tmpsize]):
if any(['GB' in tmpsize, 'MB' in tmpsize, 'KB' in tmpsize, 'TB' in tmpsize]):
tmp1 = tmpsz.find('MB', tmpsz_st)
if tmp1 == -1:
tmp1 = tmpsz.find('GB', tmpsz_st)
if tmp1 == -1:
tmp1 = tmpsz.find('TB', tmpsz_st)
if tmp1 == -1:
tmp1 = tmpsz.find('KB', tmpsz_st)
tmpsz_end = tmp1 + 2
tmpsz_st += 7
else:
tmpsz_st = tmpsz.rfind('|')
if tmpsz_st != -1:
tmpsize = tmpsz[tmpsz_st:tmpsz_st+14]
if any(['GB' in tmpsize, 'MB' in tmpsize]):
if any(['GB' in tmpsize, 'MB' in tmpsize, 'KB' in tmpsize, 'TB' in tmpsize]):
tmp1 = tmpsz.find('MB', tmpsz_st)
if tmp1 == -1:
tmp1 = tmpsz.find('GB', tmpsz_st)
if tmp1 == -1:
tmp1 = tmpsz.find('TB', tmpsz_st)
if tmp1 == -1:
tmp1 = tmpsz.find('KB', tmpsz_st)
tmpsz_end = tmp1 + 2
tmpsz_st += 2
@ -275,6 +280,12 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None):
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'
tsize = helpers.human2bytes(str(tmpsz[tmpsz_st:tmpsz.find(szform, tmpsz_st) -1]) + str(sz))