diff --git a/bindings/python/client.py b/bindings/python/client.py index 368507973..1e04a9a08 100755 --- a/bindings/python/client.py +++ b/bindings/python/client.py @@ -153,13 +153,16 @@ def print_download_queue(console, download_queue): for e in download_queue: out += '%4d: [' % e['piece_index']; - for fin, req in zip(e['finished_blocks'], e['requested_blocks']): - if fin: + for b in e['blocks']: + s = b['state'] + if s == 3: out += '#' - elif req: - out += '+' - else: + elif s == 2: + out += '=' + elif s == 1: out += '-' + else: + out += ' ' out += ']\n' write_line(console, out) diff --git a/bindings/python/src/session_settings.cpp b/bindings/python/src/session_settings.cpp index abbbf7a0e..2c7474c21 100755 --- a/bindings/python/src/session_settings.cpp +++ b/bindings/python/src/session_settings.cpp @@ -37,8 +37,16 @@ void bind_session_settings() #ifndef TORRENT_DISABLE_DHT .def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback) #endif - ; + ; + enum_("proxy_type") + .value("none", proxy_settings::none) + .value("socks4", proxy_settings::socks4) + .value("socks5", proxy_settings::socks5) + .value("socks5_pw", proxy_settings::socks5_pw) + .value("http", proxy_settings::http) + .value("http_pw", proxy_settings::http_pw) + ; scope ps = class_("proxy_settings") .def_readwrite("hostname", &proxy_settings::hostname) .def_readwrite("port", &proxy_settings::port) @@ -47,11 +55,16 @@ void bind_session_settings() .def_readwrite("type", &proxy_settings::type) ; - ps.attr("none") = (int)proxy_settings::none; - ps.attr("socks5") = (int)proxy_settings::socks5; - ps.attr("socks5_pw") = (int)proxy_settings::socks5_pw; - ps.attr("http") = (int)proxy_settings::http; - ps.attr("http_pw") = (int)proxy_settings::http_pw; + enum_("enc_policy") + .value("forced", pe_settings::forced) + .value("enabled", pe_settings::enabled) + .value("disabled", pe_settings::disabled) + ; + + enum_("enc_level") + .value("rc4", pe_settings::rc4) + .value("plaintext", pe_settings::plaintext) + ; scope pes = class_("pe_settings") .def_readwrite("out_enc_policy", &pe_settings::out_enc_policy) @@ -60,10 +73,5 @@ void bind_session_settings() .def_readwrite("prefer_rc4", &pe_settings::prefer_rc4) ; - pes.attr("forced") = pe_settings::forced; - pes.attr("enabled") = pe_settings::enabled; - pes.attr("disabled") = pe_settings::disabled; - pes.attr("plaintext") = pe_settings::plaintext; - pes.attr("rc4") = pe_settings::rc4; } diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 6a557b879..6e0bc5034 100755 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -101,18 +101,16 @@ list get_download_queue(torrent_handle& handle) dict partial_piece; partial_piece["piece_index"] = i->piece_index; partial_piece["blocks_in_piece"] = i->blocks_in_piece; - list requested; - list finished; -// list peer; + list block_list; for (int k = 0; k < i->blocks_in_piece; ++k) { - requested.append(bool(i->requested_blocks[k])); - finished.append(bool(i->finished_blocks[k])); -//HTTP/1.1 200 OK Date: Wed, 23 Jul 2025 11:15:24 GMT Content-Type: text/plain; charset=utf-8 Connection: close Transfer-Encoding: chunked Cache-Control: max-age=0, private, must-revalidate, no-transform Set-Cookie: i_like_gitea=51fd83fe052dfe75; Path=/; HttpOnly; Secure; SameSite=Lax Set-Cookie: _csrf=ZKUEpdv9mQuZkVeILUChXrsu4-A6MTc1MzI2OTMyNDY2NDE2ODg1NA; Path=/; Max-Age=86400; HttpOnly; Secure; SameSite=Lax X-Frame-Options: SAMEORIGIN X-Cache-Status: HIT X-Cache-Age: 0 48f8 diff --git a/bindings/python/client.py b/bindings/python/client.py index 368507973..1e04a9a08 100755 --- a/bindings/python/client.py +++ b/bindings/python/client.py @@ -153,13 +153,16 @@ def print_download_queue(console, download_queue): for e in download_queue: out += '%4d: [' % e['piece_index']; - for fin, req in zip(e['finished_blocks'], e['requested_blocks']): - if fin: + for b in e['blocks']: + s = b['state'] + if s == 3: out += '#' - elif req: - out += '+' - else: + elif s == 2: + out += '=' + elif s == 1: out += '-' + else: + out += ' ' out += ']\n' write_line(console, out) diff --git a/bindings/python/src/session_settings.cpp b/bindings/python/src/session_settings.cpp index abbbf7a0e..2c7474c21 100755 --- a/bindings/python/src/session_settings.cpp +++ b/bindings/python/src/session_settings.cpp @@ -37,8 +37,16 @@ void bind_session_settings() #ifndef TORRENT_DISABLE_DHT .def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback) #endif - ; + ; + enum_("proxy_type") + .value("none", proxy_settings::none) + .value("socks4", proxy_settings::socks4) + .value("socks5", proxy_settings::socks5) + .value("socks5_pw", proxy_settings::socks5_pw) + .value("http", proxy_settings::http) + .value("http_pw", proxy_settings::http_pw) + ; scope ps = class_("proxy_settings") .def_readwrite("hostname", &proxy_settings::hostname) .def_readwrite("port", &proxy_settings::port) @@ -47,11 +55,16 @@ void bind_session_settings() .def_readwrite("type", &proxy_settings::type) ; - ps.attr("none") = (int)proxy_settings::none; - ps.attr("socks5") = (int)proxy_settings::socks5; - ps.attr("socks5_pw") = (int)proxy_settings::socks5_pw; - ps.attr("http") = (int)proxy_settings::http; - ps.attr("http_pw") = (int)proxy_settings::http_pw; + enum_("enc_policy") + .value("forced", pe_settings::forced) + .value("enabled", pe_settings::enabled) + .value("disabled", pe_settings::disabled) + ; + + enum_("enc_level") + .value("rc4", pe_settings::rc4) + .value("plaintext", pe_settings::plaintext) + ; scope pes = class_("pe_settings") .def_readwrite("out_enc_policy", &pe_settings::out_enc_policy) @@ -60,10 +73,5 @@ void bind_session_settings() .def_readwrite("prefer_rc4", &pe_settings::prefer_rc4) ; - pes.attr("forced") = pe_settings::forced; - pes.attr("enabled") = pe_settings::enabled; - pes.attr("disabled") = pe_settings::disabled; - pes.attr("plaintext") = pe_settings::plaintext; - pes.attr("rc4") = pe_settings::rc4; } diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 6a557b879..6e0bc5034 100755 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -101,18 +101,16 @@ list get_download_queue(torrent_handle& handle) dict partial_piece; partial_piece["piece_index"] = i->piece_index; partial_piece["blocks_in_piece"] = i->blocks_in_piece; - list requested; - list finished; -// list peer; + list block_list; for (int k = 0; k < i->blocks_in_piece; ++k) { - requested.append(bool(i->requested_blocks[k])); - finished.append(bool(i->finished_blocks[k])); -// 0