2017-02-07 4 views
0

libtorrent python 바인딩을 사용하여 파일을 다운로드하는 python 스크립트가 있습니다. 다운로드가 완료되면 토런트를 제거하는 방법을 알고 싶습니다.libtorrent rasterbar python binding을 사용하여 완성 된 torrent를 제거하는 방법?

나는 광산을 만들기 위해 사용했던 예제 스크립트를 게시하고 있습니다. (너무 커서 데이터베이스 항목이 있기 때문에 광산을 게시하지 않습니다.)

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) 

감사합니다.

답변