deluge/test.py

41 lines
1.0 KiB
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
#*/
2007-01-08 20:07:39 +00:00
import deluge
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
2007-01-11 00:58:23 +00:00
manager = deluge.Manager("DL", "0500", "deluge - testing only",
2006-12-08 14:17:36 +00:00
os.path.expanduser("~") + "/Temp")# blank_slate=True)
2006-12-01 18:07:03 +00:00
2006-12-05 16:19:48 +00:00
#manager.set_pref('max_upload_rate', 6*1024)
2006-12-05 09:22:53 +00:00
2007-01-11 00:58:23 +00:00
##my_torrent = manager.add_torrent("ubuntu.iso.torrent", ".", True)
2006-12-03 18:20:15 +00:00
2007-01-11 00:58:23 +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():
2007-01-11 00:58:23 +00:00
state = manager.get_torrent_state(unique_ID)
for key in state.keys():
print key, state[key]
2006-12-05 14:32:17 +00:00
manager.handle_events()
2006-12-05 09:22:53 +00:00
print ""
sleep(2)
except KeyboardInterrupt:
2006-12-05 17:25:30 +00:00
print "Shutting down..."
2006-12-05 09:22:53 +00:00
manager.quit()