我需要默认的目录,一个torrent文件将创建时,它将使用任何洪流管理器-作为一个字符串。我不是程序员,但在其他帮助下,我能够以字符串的形式获得流的内容(文件):
info = libtorrent.torrent_info(torrent_file)
for f in info.files():
file_name = "%s" % (f.path)
# do something with file_name发布于 2016-06-25 01:57:14
要记住的一件事是,有两种类型的急流文件。单文件洪流和多文件洪流。这两种文件的典型文件名结构如下:
单文件洪流:保存路径/洪流名称
多文件洪流:保存路径/洪流名称/所有文件中的洪流
听起来,您在寻找洪流目录文件的名称(按照大多数客户端的约定)。即洪流的名字。
使用libtorrent在python中执行此操作的示例代码:
import libtorrent as lt
import sys
ti = lt.torrent_info(sys.argv[1])
if ti.num_files() > 1:
print(ti.name())
else:
# single-file torrent, name() may be a filename
# instead of directory namehttps://stackoverflow.com/questions/38019615
复制相似问题