Fix from_state in TorrentAddedEvent

This commit is contained in:
Calum Lind 2011-06-27 22:50:21 +01:00
parent 71f9ef6499
commit 3b5e70580e
1 changed files with 2 additions and 4 deletions

View File

@ -509,16 +509,14 @@ class TorrentManager(component.Component):
self.save_state() self.save_state()
# Emit torrent_added signal # Emit torrent_added signal
from_state = False from_state = state is not None
if torrent_info and state is None:
from_state = True
component.get("EventManager").emit( component.get("EventManager").emit(
TorrentAddedEvent(torrent.torrent_id, from_state) TorrentAddedEvent(torrent.torrent_id, from_state)
) )
log.info("Torrent %s from user \"%s\" %s", log.info("Torrent %s from user \"%s\" %s",
torrent.get_status(["name"])["name"], torrent.get_status(["name"])["name"],
torrent.get_status(["owner"])["owner"], torrent.get_status(["owner"])["owner"],
(from_state and "added" or "loaded")) (from_state and "loaded" or "added"))
return torrent.torrent_id return torrent.torrent_id
def load_torrent(self, torrent_id): def load_torrent(self, torrent_id):