update client.py

This commit is contained in:
Andrew Resch 2008-10-02 06:49:52 +00:00
parent 5ca35b8ef3
commit ff41246c42
1 changed files with 16 additions and 8 deletions

View File

@ -223,8 +223,9 @@ def main():
ses.listen_on(options.port, options.port + 10) ses.listen_on(options.port, options.port + 10)
ses.set_settings(settings) ses.set_settings(settings)
ses.set_severity_level(lt.alert.severity_levels.info) ses.set_severity_level(lt.alert.severity_levels.info)
# ses.add_extension(lt.create_ut_pex_plugin); ses.add_extension(lt.create_ut_pex_plugin)
# ses.add_extension(lt.create_metadata_plugin); ses.add_extension(lt.create_ut_metadata_plugin)
ses.add_extension(lt.create_metadata_plugin)
handles = [] handles = []
alerts = [] alerts = []
@ -241,17 +242,24 @@ def main():
resume_data = lt.bdecode(open( resume_data = lt.bdecode(open(
os.path.join(options.save_path, info.name() + '.fastresume'), 'rb').read()) os.path.join(options.save_path, info.name() + '.fastresume'), 'rb').read())
except: except:
resume_data = None resume_data = ""
h = ses.add_torrent(info, options.save_path, atp = {}
resume_data, lt.storage_mode_t.storage_mode_sparse) atp["ti"] = info
atp["save_path"] = options.save_path
atp["resume_data"] = resume_data
atp["storage_mode"] = lt.storage_mode_t.storage_mode_sparse
atp["paused"] = False
atp["auto_managed"] = True
atp["duplicate_is_error"] = True
h = ses.add_torrent(atp)
handles.append(h) handles.append(h)
h.set_max_connections(60) h.set_max_connections(60)
h.set_max_uploads(-1) h.set_max_uploads(-1)
h.set_ratio(options.ratio) h.set_ratio(options.ratio)
h.set_sequenced_download_threshold(15)
if os.name == 'nt': if os.name == 'nt':
console = WindowsConsole() console = WindowsConsole()
@ -274,7 +282,7 @@ def main():
s = h.status() s = h.status()
if s.state != lt.torrent_status.seeding: if s.state != lt.torrent_status.seeding:
state_str = ['queued', 'checking', 'connecting', 'downloading metadata', \ state_str = ['queued', 'checking', 'downloading metadata', \
'downloading', 'finished', 'seeding', 'allocating'] 'downloading', 'finished', 'seeding', 'allocating']
out += state_str[s.state] + ' ' out += state_str[s.state] + ' '
@ -328,7 +336,7 @@ def main():
if type(a) == str: if type(a) == str:
write_line(console, a + '\n') write_line(console, a + '\n')
else: else:
write_line(console, a.msg() + '\n') write_line(console, a.message() + '\n')
c = console.sleep_and_input(0.5) c = console.sleep_and_input(0.5)