创建Torrent的基本库
makeTorrent的Python项目详细描述
用于生成单个和多个文件种子的基本python库。
用法
基本用法:
frommakeTorrentimportmakeTorrentmk=makeTorrent(announce='http://example.com/announce')
此时,maketorrent类包含一个字典,它可以作为dict或bencoded字符串(torrent格式)打印。
要添加文件,请使用多文件类或单个文件类:
mk.multi_file('/path/to/directory')withopen('my.torrent')astf:tf.write(mk.getBencoded())
同样的方法可以用于mk.single_file
,只需指出一个文件。
注释
初始化类时可以添加许多项:
mk=makeTorrent(announce='http://example.com/announce',comment='Test Torrent',httpseeds=['http://example.com/file.iso'],announcelist=[['http://announce1.example.com'],['http://announce2.example.com']])