Ticket #2474: Replace add_torrent with async_add_torrent.patch

File Replace add_torrent with async_add_torrent.patch, 4.1 KB (added by Doadin, 10 years ago)
  • deluge/core/torrentmanager.py

    <!-- 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 &lt;tbkizle@gmail.com&gt;
    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,  
    478478
    479479        handle = None
    480480        try:
    481             handle = self.session.add_torrent(add_torrent_params)
     481            handle = self.session.async_add_torrent(async_add_torrent_params)
    482482        except RuntimeError as ex:
    483483            log.warning("Error adding torrent: %s", ex)
    484484
    def on_alert_save_resume_data(self, alert):  
    11191119            return
    11201120
    11211121        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
    11231123            self.resume_data[torrent_id] = lt.bencode(alert.resume_data)
    11241124
    11251125        if torrent_id in self.waiting_on_resume_data:
  • deluge/ui/console/modes/add_util.py

    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):  
    6161    newpath = newpath.replace(unichr(sentinal),"[]]")
    6262    return newpath
    6363
    64 def add_torrent(t_file, options, success_cb, fail_cb, ress):
     64def async_add_torrent(t_file, options, success_cb, fail_cb, ress):
    6565    t_options = {}
    6666    if options["path"]:
    6767        t_options["download_location"] = os.path.expanduser(options["path"])
  • deluge/ui/console/modes/alltorrents.py

    diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py
    index fc1f870..eb8e41d 100644
    a b  
    4545from deluge.ui.sessionproxy import SessionProxy
    4646
    4747from popup import Popup, SelectablePopup, MessagePopup, ALIGN
    48 from add_util import add_torrent
     48from add_util import async_add_torrent
    4949from input_popup import InputPopup, ALIGN
    5050from torrentdetail import TorrentDetail
    5151from addtorrents import AddTorrents
  • deluge/ui/console/modes/torrentdetail.py

    diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py
    index 095fea4..aac9499 100644
    a b  
    4646from deluge.ui.sessionproxy import SessionProxy
    4747
    4848from popup import Popup,SelectablePopup,MessagePopup
    49 from add_util import add_torrent
     49from add_util import async_add_torrent
    5050from input_popup import InputPopup
    5151import deluge.ui.console.colors as colors
    5252import format_utils
  • deluge/ui/gtkui/queuedtorrents.py

    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):  
    172172
    173173    def on_button_add_clicked(self, widget):
    174174        # Add all the torrents in the liststore
    175         def add_torrent(model, path, iter, data):
     175        def async_add_torrent(model, path, iter, data):
    176176            torrent_path = model.get_value(iter, 1).decode('utf-8')
    177177            process_args([torrent_path])
    178178
    179         self.liststore.foreach(add_torrent, None)
     179        self.liststore.foreach(async_add_torrent, None)
    180180        del self.queue[:]
    181181        self.dialog.hide()
    182182        self.update_status_bar()