Opened 6 months ago

#3421 new bug

Plugins don't receive TorrentFileCompletedEvent / file_completed_alert

Reported by: quantcon Owned by:
Priority: minor Milestone: needs verified
Component: Core Version: 2.0.0
Keywords: Cc:

Description

Deluge doesn't emit TorrentFileCompletedEvent? (through EventManager?) or file_completed_alert (through AlertManager?). This is because Deluge omits adding the file_progress flag to the alert_mask in alertmanager.py line 52.

Once that mask is added, plugins start receiving that event. Can be verified using the following plugin code and downloading a torrent.

from __future__ import unicode_literals

from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component

class Core(CorePluginBase):

    def enable(self):
        print('Plugin enabled')
        component.get('EventManager').register_event_handler('TorrentFileCompletedEvent', self.on_file_completed)

    def on_file_completed(self, torrent_id, index):
        print('file completed, torrent_id {}, file index {}'.format(torrent_id, index))

Change History (0)

Note: See TracTickets for help on using tickets.