forked from enlightenment/epour
Add back handling of torrent paused/resumed
This commit is contained in:
parent
194b1815c8
commit
65a35cf741
|
@ -182,23 +182,31 @@ class MainInterface(object):
|
|||
def torrent_removed_cb(a):
|
||||
self.remove_torrent_item(str(a.info_hash))
|
||||
|
||||
# def torrent_update_cb(a):
|
||||
# self.remove_torrent_item(str(a.old_ih))
|
||||
# new_h = self._session.find_torrent(str(a.new_ih))
|
||||
# self.add_torrent_item(new_h)
|
||||
|
||||
session.alert_manager.callback_add(
|
||||
"torrent_added_alert", torrent_added_cb)
|
||||
session.alert_manager.callback_add(
|
||||
"torrent_removed_alert", torrent_removed_cb)
|
||||
# session.alert_manager.callback_add(
|
||||
# "torrent_update_alert", torrent_update_cb)
|
||||
|
||||
# def torrent_paused_cb(a):
|
||||
# self.update_icon(a.handle)
|
||||
def torrent_paused_resumed_cb(a):
|
||||
h = a.handle
|
||||
if not h.is_valid():
|
||||
log.debug("State changed for invalid handle.")
|
||||
return
|
||||
|
||||
# for a_name in "torrent_paused_alert", "torrent_resumed_alert":
|
||||
# session.alert_manager.callback_add(a_name, torrent_paused_cb)
|
||||
info_hash = str(h.info_hash())
|
||||
if info_hash not in self.torrentitems:
|
||||
log.debug("%s state changed but not in list", str(info_hash))
|
||||
return
|
||||
|
||||
torrent = self._session.torrents[info_hash]
|
||||
torrent.state = h.status(0).state
|
||||
|
||||
self.torrentitems[info_hash].fields_update(
|
||||
"elm.swallow.icon", ELM_GENLIST_ITEM_FIELD_CONTENT
|
||||
)
|
||||
|
||||
for a_name in "torrent_paused_alert", "torrent_resumed_alert":
|
||||
session.alert_manager.callback_add(a_name, torrent_paused_resumed_cb)
|
||||
|
||||
def state_changed_cb(a):
|
||||
h = a.handle
|
||||
|
|
Loading…
Reference in New Issue