create torrent successful for empty file in libtorrent == 1.1.8.0 but failed in libtorrent == 2.0.9.0
import libtorrent as lt
fs = lt.file_storage()
lt.add_files(fs, file)
t = lt.create_torrent(fs, trunk_size)
# for track_url in track_urls:
# t.add_tracker(track_url, 0)
t.set_creator('libtorrent %s' % lt.version)
for i in xrange(len(piece_hashes)):
t.set_hash(i, piece_hashes[i])
# make torrent file
with open(torrent_file, 'wb+') as f:
f.write(lt.bencode(t.generate()))
when file is empty, never to set_hash for t, and the code will error at t.generate() with missing or invalid ‘hash’ entry [libtorrent:175]
what is the actual question ? where are you stuck ?