File completed event never fires
Posted: Thu Jul 30, 2020 9:18 pm
Hi, I am not receiving the
I never get the alert. I've tried with other events like
EDIT: Just to clarify, this event is supposed to fire whenever any file in any torrent finishes downloading, right? At least that's what I got from the libtorrent docs.
TorrentFileCompletedEvent
in my plugin. Here is a minimal code to reproduce the issue:Code: Select all
from __future__ import unicode_literals
import logging
import deluge.configmanager
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
}
class Core(CorePluginBase):
def enable(self):
print('TestFileCompletedEvent enabled')
self.config = deluge.configmanager.ConfigManager(
'testfilecompletedevent.conf', DEFAULT_PREFS)
# I've tried the following three ways:
# component.get('AlertManager').register_handler('file_completed_alert', self.on_file_completed)
# component.get('AlertManager').register_handler('TorrentFileCompletedEvent', self.on_file_completed)
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))
TorrentAddedEvent
, and that seems to work just fine. Any ideas what I'm doing wrong?EDIT: Just to clarify, this event is supposed to fire whenever any file in any torrent finishes downloading, right? At least that's what I got from the libtorrent docs.