Add PreTorrentRemovedEvent event
This commit is contained in:
parent
8373377c10
commit
42dce915df
@ -430,6 +430,9 @@ class TorrentManager(component.Component):
|
|||||||
|
|
||||||
def remove(self, torrent_id, remove_data=False):
|
def remove(self, torrent_id, remove_data=False):
|
||||||
"""Remove a torrent from the manager"""
|
"""Remove a torrent from the manager"""
|
||||||
|
# Emit the signal to the clients
|
||||||
|
component.get("EventManager").emit(PreTorrentRemovedEvent(torrent_id))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.session.remove_torrent(self.torrents[torrent_id].handle,
|
self.session.remove_torrent(self.torrents[torrent_id].handle,
|
||||||
1 if remove_data else 0)
|
1 if remove_data else 0)
|
||||||
|
|||||||
@ -69,6 +69,16 @@ class TorrentRemovedEvent(DelugeEvent):
|
|||||||
"""
|
"""
|
||||||
self._args = [torrent_id]
|
self._args = [torrent_id]
|
||||||
|
|
||||||
|
class PreTorrentRemovedEvent(DelugeEvent):
|
||||||
|
"""
|
||||||
|
Emitted when a torrent is about to be removed from the session.
|
||||||
|
"""
|
||||||
|
def __init__(self, torrent_id):
|
||||||
|
"""
|
||||||
|
:param torrent_id: str, the torrent_id
|
||||||
|
"""
|
||||||
|
self._args = [torrent_id]
|
||||||
|
|
||||||
class TorrentStateChangedEvent(DelugeEvent):
|
class TorrentStateChangedEvent(DelugeEvent):
|
||||||
"""
|
"""
|
||||||
Emitted when a torrent changes state.
|
Emitted when a torrent changes state.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user