Emit 'torrent_status_changed' signal to the clients
This commit is contained in:
parent
bf70ff03a3
commit
135a3d75f1
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
@ -143,4 +145,7 @@ class Signals(component.Component):
|
||||||
log.debug("args_from_external: %s", value)
|
log.debug("args_from_external: %s", value)
|
||||||
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue