2017-02-07 5 views
0

私はlibtorrentのpythonバインディングを使ってファイルをダウンロードするpythonスクリプトを持っています。ダウンロードが完了したら、トレントを削除する方法を知りたいだけです。libtorrent rasterbar python bindingを使って完成したトレントを削除するには?

私は私のものを作るのに使ったスクリプトの例をここに掲載しています(私はそれが大きすぎるので私の投稿ではない、データベース部分を持っている)。

import libtorrent as lt 
import time 

ses = lt.session() 
params = { 'save_path': '/home/downloads/'} 
link = "magnet:?xt=urn:btih:4MR6HU7SIHXAXQQFXFJTNLTYSREDR5EI&tr=http://tracker.vodo.net:6970/announce" 
handle = lt.add_magnet_uri(ses, link, params) 

print 'downloading metadata...' 
while (not handle.has_metadata()): time.sleep(1) 
print 'got metadata, starting torrent download...' 
while (handle.status().state != lt.torrent_status.seeding): 
    print '%d %% done' % (handle.status().progress*100) 
    time.sleep(1) 

ありがとう。

答えて

関連する問題