not all torrents have announce

This commit is contained in:
j 2020-07-28 11:36:20 +02:00
parent 0df326eaf8
commit a2c9309808

View file

@ -55,7 +55,8 @@ def get_torrent_info(data=None, file=None):
tinfo[key] = metainfo[key] tinfo[key] = metainfo[key]
tinfo['size'] = file_length tinfo['size'] = file_length
tinfo['hash'] = sha1(bencode(info)).hexdigest() tinfo['hash'] = sha1(bencode(info)).hexdigest()
tinfo['announce'] = metainfo['announce'] if 'announce' in metainfo:
tinfo['announce'] = metainfo['announce']
if file: if file:
tinfo['timestamp'] = os.stat(file).st_ctime tinfo['timestamp'] = os.stat(file).st_ctime
return tinfo return tinfo