mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 23:53:23 +00:00
Fix adding/removing torrents with current libtorrent.
This commit is contained in:
parent
b02b71e978
commit
c259aea06a
@ -172,12 +172,18 @@ class TorrentManager:
|
|||||||
if compact is None:
|
if compact is None:
|
||||||
compact = self.config["compact_allocation"]
|
compact = self.config["compact_allocation"]
|
||||||
|
|
||||||
|
# Set the right storage_mode
|
||||||
|
if compact:
|
||||||
|
storage_mode = lt.storage_mode_t(1)
|
||||||
|
else:
|
||||||
|
storage_mode = lt.storage_mode_t(2)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
handle = self.session.add_torrent(
|
handle = self.session.add_torrent(
|
||||||
lt.torrent_info(torrent_filedump),
|
lt.torrent_info(torrent_filedump),
|
||||||
str(save_path),
|
str(save_path),
|
||||||
resume_data=fastresume,
|
resume_data=fastresume,
|
||||||
compact_mode=compact,
|
storage_mode=storage_mode,
|
||||||
paused=paused)
|
paused=paused)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
log.warning("Error adding torrent")
|
log.warning("Error adding torrent")
|
||||||
@ -228,7 +234,7 @@ class TorrentManager:
|
|||||||
"""Remove a torrent from the manager"""
|
"""Remove a torrent from the manager"""
|
||||||
try:
|
try:
|
||||||
# Remove from libtorrent session
|
# Remove from libtorrent session
|
||||||
self.session.remove_torrent(self.torrents[torrent_id].handle)
|
self.session.remove_torrent(self.torrents[torrent_id].handle, 0)
|
||||||
except RuntimeError, KeyError:
|
except RuntimeError, KeyError:
|
||||||
log.warning("Error removing torrent")
|
log.warning("Error removing torrent")
|
||||||
return False
|
return False
|
||||||
|
@ -185,8 +185,8 @@ void bind_session()
|
|||||||
.def(
|
.def(
|
||||||
"add_torrent", &add_torrent
|
"add_torrent", &add_torrent
|
||||||
, (
|
, (
|
||||||
arg("resume_data") = entry(), arg("compact_mode") = true
|
arg("resume_data") = entry(), arg("storage_mode") = storage_mode_sparse,
|
||||||
, arg("paused") = false
|
arg("paused") = false
|
||||||
)
|
)
|
||||||
, session_add_torrent_doc
|
, session_add_torrent_doc
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user