Emit 'torrent_status_changed' signal to the clients

This commit is contained in:
Andrew Resch 2008-07-03 23:52:27 +00:00
parent bf70ff03a3
commit 135a3d75f1
2 changed files with 13 additions and 0 deletions

View File

@ -147,6 +147,8 @@ class TorrentManager(component.Component):
self.on_alert_storage_moved) self.on_alert_storage_moved)
self.alerts.register_handler("torrent_resumed_alert", self.alerts.register_handler("torrent_resumed_alert",
self.on_alert_torrent_resumed) self.on_alert_torrent_resumed)
self.alerts.register_handler("state_changed_alert",
self.on_alert_state_changed)
def start(self): def start(self):
# Get the pluginmanager reference # Get the pluginmanager reference
@ -701,3 +703,9 @@ class TorrentManager(component.Component):
torrent = self.torrents[str(alert.handle.info_hash())] torrent = self.torrents[str(alert.handle.info_hash())]
torrent.is_finished = torrent.handle.is_seed() torrent.is_finished = torrent.handle.is_seed()
torrent.update_state() torrent.update_state()
def on_alert_state_changed(self, alert):
log.debug("on_alert_state_changed")
torrent_id = str(alert.handle.info_hash())
component.get("SignalManager").emit("torrent_state_changed", torrent_id)

View File

@ -72,6 +72,8 @@ class Signals(component.Component):
self.new_version_available) self.new_version_available)
self.receiver.connect_to_signal("args_from_external", self.receiver.connect_to_signal("args_from_external",
self.args_from_external) self.args_from_external)
self.receiver.connect_to_signal("torrent_state_changed",
self.torrent_state_changed)
def stop(self): def stop(self):
try: try:
@ -144,3 +146,6 @@ class Signals(component.Component):
import ipcinterface import ipcinterface
ipcinterface.process_args(value) ipcinterface.process_args(value)
def torrent_state_changed(self, value):
log.debug("torrent_state_changed: %s", value)