[Deluge] #3421: Plugins don't receive TorrentFileCompletedEvent / file_completed_alert

3 views
Skip to first unread message

Deluge

unread,
Aug 4, 2020, 7:37:25 AM8/4/20
to delug...@googlegroups.com
#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

Reply all
Reply to author
Forward
0 new messages