Fix py-unrar2 on unix to handle different date formats output by different unrar command line versions.

Fix an indentation typo.
Update HACKS.txt.
This commit is contained in:
JackDandy 2015-10-13 04:08:45 +01:00
parent 0b3cf5284e
commit 24b1e193aa
3 changed files with 13 additions and 3 deletions

View file

@ -45,6 +45,7 @@
* Change disable ToTV due to non-deletable yet reported hacker BTC inbox scam and also little to no new content listings
* Fix Episode View KeyError: 'state-title' failure for shows without a runtime
* Update py-unrar2 library 99.3 to 99.6 (2fe1e98)
* Fix py-unrar2 on unix to handle different date formats output by different unrar command line versions
[develop changelog]
Enable Alpha Ratio again now that the secure login page over https is fixed

View file

@ -6,3 +6,4 @@ Libs with customisations...
/lib/requests/packages/urllib3/connectionpool.py
/lib/requests/packages/urllib3/util/ssl_.py
/tornado
/lib/unrar2/unix.py

View file

@ -153,7 +153,7 @@ class RarFileImplementation(object):
data['size'] = int(fields[0])
attr = fields[5]
data['isdir'] = 'd' in attr.lower()
data['datetime'] = time.strptime(fields[3]+" "+fields[4], '%d-%m-%y %H:%M')
data['datetime'] = self.rarcmd_dt(fields[3], fields[4])
data['comment'] = None
data['volume'] = None
yield data
@ -169,13 +169,21 @@ class RarFileImplementation(object):
data['size'] = int(fields[1])
attr = fields[0]
data['isdir'] = 'd' in attr.lower()
data['datetime'] = time.strptime(fields[2]+" "+fields[3], '%d-%m-%y %H:%M')
data['datetime'] = self.rarcmd_dt(fields[2], fields[3])
data['comment'] = None
data['volume'] = None
data['volume'] = None
yield data
i += 1
line = source.next()
@staticmethod
def rarcmd_dt(param_date=time.strftime('%Y-%m-%d'), param_time=time.strftime('%H:%M')):
for str_fmt in '%Y-%m-%d %H:%M', '%Y-%m-%d %H:%M':
try:
return time.strptime('%s %s' % (param_date, param_time), str_fmt)
except ValueError:
pass
return time.strptime('%s %s' % (time.strftime('%Y-%m-%d'), time.strftime('%H:%M')), '%Y-%m-%d %H:%M')
def read_files(self, checker):
res = []