+ del torrent[b'info'][b'pieces']
+ if b'info' not in torrent:
+ torrent_error('Info absent')
+
+ if PY3:
+ codepage = torrent.get(b'codepage', None)
+ encoding = torrent.get(b'encoding', None)
+ if encoding:
+ encoding = encoding.decode('ascii')
+ elif codepage:
+ encoding = codepage.decode('ascii')
+ else:
+ for encoding in ('ascii', 'utf-8', default_encoding):
+ try:
+ return decode_dict(torrent, encoding)
+ except UnicodeDecodeError:
+ pass
+ torrent_error('UnicodeDecodeError')
+ return decode_dict(torrent, encoding)
+
+ return torrent
+
+
+def decode_datetime_asc(dt):
+ try:
+ return asctime(localtime(float(dt)))
+ except ValueError:
+ return datetime.max.ctime()
+