From f326525e8e81b7ed5cbc95c7c48380b9e0f30363 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 29 Sep 2012 05:10:34 +0000 Subject: [PATCH] merged python fixes from RC_0_16 --- bindings/python/client.py | 17 +++++++++++------ bindings/python/src/session_settings.cpp | 3 +++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bindings/python/client.py b/bindings/python/client.py index c1f45ba43..35a5de893 100755 --- a/bindings/python/client.py +++ b/bindings/python/client.py @@ -159,9 +159,6 @@ def main(): parser.add_option('-p', '--port', type='int', help='set listening port') - parser.add_option('-r', '--ratio', - type='float', help='set the preferred upload/download ratio. 0 means infinite. Values smaller than 1 are clamped to 1') - parser.add_option('-d', '--max-download-rate', type='float', help='the maximum download rate given in kB/s. 0 means infinite.') @@ -174,13 +171,16 @@ def main(): parser.add_option('-a', '--allocation-mode', type='string', help='sets mode used for allocating the downloaded files on disk. Possible options are [full | compact]') + parser.add_option('-r', '--proxy-host', + type='string', help='sets HTTP proxy host and port (separated by \':\')') + parser.set_defaults( port=6881 - , ratio=0 , max_download_rate=0 , max_upload_rate=0 , save_path='./' , allocation_mode='compact' + , proxy_host='' ) (options, args) = parser.parse_args() @@ -208,6 +208,13 @@ def main(): ses.set_settings(settings) ses.set_alert_mask(0xfffffff) + if options.proxy_host != '': + ps = lt.proxy_settings() + ps.type = lt.proxy_type.http + ps.hostname = options.proxy_host.split(':')[0] + ps.port = int(options.proxy_host.split(':')[1]) + ses.set_proxy(ps) + handles = [] alerts = [] @@ -235,7 +242,6 @@ def main(): h.set_max_connections(60) h.set_max_uploads(-1) - h.set_ratio(options.ratio) if os.name == 'nt': console = WindowsConsole() @@ -276,7 +282,6 @@ def main(): % (add_suffix(s.download_rate), add_suffix(s.total_download)) out += 'upload: %s/s (%s) ' \ % (add_suffix(s.upload_rate), add_suffix(s.total_upload)) - out += 'ratio: %s\n' % '0' if s.state != lt.torrent_status.seeding: out += 'info-hash: %s\n' % h.info_hash() diff --git a/bindings/python/src/session_settings.cpp b/bindings/python/src/session_settings.cpp index cddab28c7..b3494353f 100644 --- a/bindings/python/src/session_settings.cpp +++ b/bindings/python/src/session_settings.cpp @@ -181,6 +181,7 @@ void bind_session_settings() .value("socks5_pw", proxy_settings::socks5_pw) .value("http", proxy_settings::http) .value("http_pw", proxy_settings::http_pw) + .value("i2p_proxy", proxy_settings::i2p_proxy) ; enum_("disk_cache_algo_t") @@ -212,6 +213,8 @@ void bind_session_settings() .def_readwrite("password", &proxy_settings::password) .def_readwrite("username", &proxy_settings::username) .def_readwrite("type", &proxy_settings::type) + .def_readwrite("proxy_peer_connections", &proxy_settings::proxy_peer_connections) + .def_readwrite("proxy_hostnames", &proxy_settings::proxy_hostnames) ; #ifndef TORRENT_DISABLE_DHT