<!-- saved from url=(0086)https://github.com/doadin/deluge/commit/74134a4e1807baf28e180e5b49d63dd87f9af56d.patch -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 74134a4e1807baf28e180e5b49d63dd87f9af56d Mon Sep 17 00:00:00 2001
From: Doadin <tbkizle@gmail.com>
Date: Sun, 6 Jul 2014 22:53:22 -0400
Subject: [PATCH] Replace add_torrent with async_add_torrent
---
deluge/core/torrentmanager.py | 4 ++--
deluge/ui/console/modes/add_util.py | 2 +-
deluge/ui/console/modes/alltorrents.py | 2 +-
deluge/ui/console/modes/torrentdetail.py | 2 +-
deluge/ui/gtkui/queuedtorrents.py | 4 ++--
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index c762aa0..f8f98e8 100644
a
|
b
|
def add(self, torrent_info=None, state=None, options=None, save_state=True,
|
478 | 478 | |
479 | 479 | handle = None |
480 | 480 | try: |
481 | | handle = self.session.add_torrent(add_torrent_params) |
| 481 | handle = self.session.async_add_torrent(async_add_torrent_params) |
482 | 482 | except RuntimeError as ex: |
483 | 483 | log.warning("Error adding torrent: %s", ex) |
484 | 484 | |
… |
… |
def on_alert_save_resume_data(self, alert):
|
1119 | 1119 | return |
1120 | 1120 | |
1121 | 1121 | if torrent_id in self.torrents: |
1122 | | # Libtorrent in add_torrent() expects resume_data to be bencoded |
| 1122 | # Libtorrent in async_add_torrent() expects resume_data to be bencoded |
1123 | 1123 | self.resume_data[torrent_id] = lt.bencode(alert.resume_data) |
1124 | 1124 | |
1125 | 1125 | if torrent_id in self.waiting_on_resume_data: |
diff --git a/deluge/ui/console/modes/add_util.py b/deluge/ui/console/modes/add_util.py
index b741a6a..ca17328 100644
a
|
b
|
def __bracket_fixup(path):
|
61 | 61 | newpath = newpath.replace(unichr(sentinal),"[]]") |
62 | 62 | return newpath |
63 | 63 | |
64 | | def add_torrent(t_file, options, success_cb, fail_cb, ress): |
| 64 | def async_add_torrent(t_file, options, success_cb, fail_cb, ress): |
65 | 65 | t_options = {} |
66 | 66 | if options["path"]: |
67 | 67 | t_options["download_location"] = os.path.expanduser(options["path"]) |
diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py
index fc1f870..eb8e41d 100644
a
|
b
|
|
45 | 45 | from deluge.ui.sessionproxy import SessionProxy |
46 | 46 | |
47 | 47 | from popup import Popup, SelectablePopup, MessagePopup, ALIGN |
48 | | from add_util import add_torrent |
| 48 | from add_util import async_add_torrent |
49 | 49 | from input_popup import InputPopup, ALIGN |
50 | 50 | from torrentdetail import TorrentDetail |
51 | 51 | from addtorrents import AddTorrents |
diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py
index 095fea4..aac9499 100644
a
|
b
|
|
46 | 46 | from deluge.ui.sessionproxy import SessionProxy |
47 | 47 | |
48 | 48 | from popup import Popup,SelectablePopup,MessagePopup |
49 | | from add_util import add_torrent |
| 49 | from add_util import async_add_torrent |
50 | 50 | from input_popup import InputPopup |
51 | 51 | import deluge.ui.console.colors as colors |
52 | 52 | import format_utils |
diff --git a/deluge/ui/gtkui/queuedtorrents.py b/deluge/ui/gtkui/queuedtorrents.py
index 7eeaaa7..28fbf7d 100644
a
|
b
|
def on_button_close_clicked(self, widget):
|
172 | 172 | |
173 | 173 | def on_button_add_clicked(self, widget): |
174 | 174 | # Add all the torrents in the liststore |
175 | | def add_torrent(model, path, iter, data): |
| 175 | def async_add_torrent(model, path, iter, data): |
176 | 176 | torrent_path = model.get_value(iter, 1).decode('utf-8') |
177 | 177 | process_args([torrent_path]) |
178 | 178 | |
179 | | self.liststore.foreach(add_torrent, None) |
| 179 | self.liststore.foreach(async_add_torrent, None) |
180 | 180 | del self.queue[:] |
181 | 181 | self.dialog.hide() |
182 | 182 | self.update_status_bar() |