#3421: Plugins don't receive TorrentFileCompletedEvent / file_completed_alert
----------------------------+-------------------
Reporter: quantcon | Type: bug
Status: new | Priority: minor
Milestone: needs verified | Component: Core
Version: 2.0.0 | Keywords:
----------------------------+-------------------
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))
}}}
--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3421>
Deluge <https://deluge-torrent.org/>
Deluge Project
--
You received this message because you are subscribed to the Google Groups
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/deluge-dev/047.c1a6b139373b283125829cad2b6450df%40deluge-torrent.org.