[Core] Write torrent file with full magnet metainfo

The use of torrent_info.metadata misses saves trackers and other torrent
metainfo fields so use lt.create_torrent generate method to create this
data.
This commit is contained in:
Calum Lind 2019-05-18 14:43:13 +01:00
parent cbcf8eb863
commit 6a5bb44d5b

View File

@ -1295,9 +1295,9 @@ class Torrent(object):
filepath = os.path.join(get_config_dir(), 'state', self.torrent_id + '.torrent') filepath = os.path.join(get_config_dir(), 'state', self.torrent_id + '.torrent')
if filedump is None: if filedump is None:
metadata = lt.bdecode(self.torrent_info.metadata()) lt_ct = lt.create_torrent(self.torrent_info)
torrent_file = {b'info': metadata} filedump = lt.bencode(lt_ct.generate())
filedump = lt.bencode(torrent_file)
write_file(filepath, filedump) write_file(filepath, filedump)
# If the user has requested a copy of the torrent be saved elsewhere we need to do that. # If the user has requested a copy of the torrent be saved elsewhere we need to do that.