我使用的是python 3.6的libtorrent。我只想得到任何通过会话下载的文件名,例如文件夹名,文件名等。我在网上搜索,没有找到任何东西。我使用了下面的例子:
https://www.libtorrent.org/python_binding.html
因此,当下载进度完成时,我想知道此会话下载了哪些文件。怎样才能做到这一点?提前感谢!
发布于 2018-06-09 06:17:47
最终找到了答案,代码是:
handle = libtorrent.add_magnet_uri(session, magnetLink,params)
session.start_dht()
while not handle.has_metadata():
time.sleep(1)
torinfo = handle.get_torrent_info()
for x in range(torinfo.files().num_files()):
print(torinfo.files().file_path(x))
上面的代码打印磁铁文件附带的文件名。
https://stackoverflow.com/questions/50768656
复制相似问题