From fefc78f468bee9f8fe6118f49ad80195edccbf16 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 20 Jul 2008 20:32:54 +0000 Subject: [PATCH] Fix #358 properly emit torrent_removed signal to clients when torrent is removed by queue system --- deluge/core/core.py | 2 -- deluge/core/torrentmanager.py | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 38b96559d..15575f5b2 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -424,8 +424,6 @@ class Core( if self.torrents.remove(torrent_id, remove_torrent, remove_data): # Run the plugin hooks for 'post_torrent_remove' self.plugins.run_post_torrent_remove(torrent_id) - # Emit the torrent_removed signal - self.torrent_removed(torrent_id) def export_force_reannounce(self, torrent_ids): log.debug("Forcing reannouncment to: %s", torrent_ids) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 004043df7..e1392524d 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -186,10 +186,11 @@ class TorrentManager(component.Component): if torrent.stop_at_ratio: stop_ratio = torrent.stop_ratio if torrent.get_ratio() >= stop_ratio and torrent.is_finished: - if not torrent.handle.is_paused(): - torrent.pause() if self.config["remove_seed_at_ratio"] or torrent.remove_at_ratio: self.remove(torrent_id) + break + if not torrent.handle.is_paused(): + torrent.pause() def __getitem__(self, torrent_id): """Return the Torrent with torrent_id""" @@ -434,6 +435,10 @@ class TorrentManager(component.Component): # Save the session state self.save_state() + + # Emit the signal to the clients + self.signals.emit("torrent_removed", torrent_id) + return True def pause_all(self):