deluge/library/test.py

38 lines
975 B
Python
Raw Normal View History

2006-12-01 18:07:03 +00:00
#/*
#Copyright: A. Zakai ('Kripken') <kripkensteiner@gmail.com> http://6thsenseless.blogspot.com
#
#2006-15-9
#
#This code is licensed under the terms of the GNU General Public License (GPL),
#version 2 or above; See /usr/share/common-licenses/GPL , or see
#http://www.fsf.org/licensing/licenses/gpl.html
#*/
2006-12-03 18:20:15 +00:00
import pytorrent
2006-12-01 18:07:03 +00:00
from time import sleep
2006-12-03 19:08:51 +00:00
import os
2006-12-01 18:07:03 +00:00
2006-12-03 19:08:51 +00:00
manager = pytorrent.manager("PT", "0500", "pytorrent - testing only",
2006-12-04 16:42:35 +00:00
os.path.expanduser("~") + "/Temp")
2006-12-01 18:07:03 +00:00
2006-12-05 09:22:53 +00:00
#manager.prefs['max_active_torrents'] = 1
2006-12-05 14:34:01 +00:00
my_torrent = manager.add_torrent("xubuntu-6.10-desktop-i386.iso.torrent", ".", True)
2006-12-03 18:20:15 +00:00
2006-12-03 19:08:51 +00:00
#print "Unique ID:", my_torrent
2006-12-01 18:07:03 +00:00
2006-12-05 09:22:53 +00:00
print "PREFS:", manager.prefs
try:
while True:
2006-12-05 14:32:17 +00:00
print "STATE:", manager.get_state()
print "# torrents:", manager.get_num_torrents()
for unique_ID in manager.get_unique_IDs():
print unique_ID, manager.get_torrent_state(unique_ID)
manager.handle_events()
2006-12-05 09:22:53 +00:00
print ""
sleep(2)
except KeyboardInterrupt:
manager.quit()