mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 15:43:28 +00:00
Fix adding/removing torrents with current libtorrent.
This commit is contained in:
parent
b02b71e978
commit
c259aea06a
@ -171,13 +171,19 @@ class TorrentManager:
|
||||
# Make sure we are adding it with the correct allocation method.
|
||||
if compact is None:
|
||||
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:
|
||||
handle = self.session.add_torrent(
|
||||
lt.torrent_info(torrent_filedump),
|
||||
str(save_path),
|
||||
resume_data=fastresume,
|
||||
compact_mode=compact,
|
||||
storage_mode=storage_mode,
|
||||
paused=paused)
|
||||
except RuntimeError:
|
||||
log.warning("Error adding torrent")
|
||||
@ -228,7 +234,7 @@ class TorrentManager:
|
||||
"""Remove a torrent from the manager"""
|
||||
try:
|
||||
# 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:
|
||||
log.warning("Error removing torrent")
|
||||
return False
|
||||
|
@ -185,8 +185,8 @@ void bind_session()
|
||||
.def(
|
||||
"add_torrent", &add_torrent
|
||||
, (
|
||||
arg("resume_data") = entry(), arg("compact_mode") = true
|
||||
, arg("paused") = false
|
||||
arg("resume_data") = entry(), arg("storage_mode") = storage_mode_sparse,
|
||||
arg("paused") = false
|
||||
)
|
||||
, session_add_torrent_doc
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user