mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 06:58:42 +00:00
[Core] Workaround torrent file_progress lt 2.0 error
Workaround lt 2.0 python bindings error when calling a torrent handle
file_progress:
```
Boost.Python.ArgumentError: Python argument types in
torrent_handle.file_progress(torrent_handle)
did not match C++ signature:
file_progress(libtorrent::torrent_handle {lvalue}, libtorrent:🎏:bitfield_flag<unsigned char, libtorrent::file_progress_flags_tag, void> flags=0)
```
Should be fixed in 2.0.5 release: 3feba04e6d
This commit is contained in:
parent
9c3982d4ff
commit
de4fbd2e82
1 changed files with 10 additions and 3 deletions
|
@ -874,11 +874,18 @@ class Torrent(object):
|
|||
"""
|
||||
if not self.has_metadata:
|
||||
return []
|
||||
return [
|
||||
progress / _file.size if _file.size else 0.0
|
||||
for progress, _file in zip(
|
||||
|
||||
try:
|
||||
files_progresses = zip(
|
||||
self.handle.file_progress(), self.torrent_info.files()
|
||||
)
|
||||
except Exception:
|
||||
# Handle libtorrent >=2.0.0,<=2.0.4 file_progress error
|
||||
files_progresses = zip(iter(lambda: 0, 1), self.torrent_info.files())
|
||||
|
||||
return [
|
||||
progress / _file.size if _file.size else 0.0
|
||||
for progress, _file in files_progresses
|
||||
]
|
||||
|
||||
def get_tracker_host(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue