Add TorrentStorageMovedEvent for #637

This commit is contained in:
Calum Lind 2014-01-19 17:38:57 +00:00
parent 7271472e13
commit 35842af019

View File

@ -43,6 +43,7 @@ and subsequently emitted to the clients.
known_events = {} known_events = {}
class DelugeEventMetaClass(type): class DelugeEventMetaClass(type):
""" """
This metaclass simply keeps a list of all events classes created. This metaclass simply keeps a list of all events classes created.
@ -52,6 +53,7 @@ class DelugeEventMetaClass(type):
if name != "DelugeEvent": if name != "DelugeEvent":
known_events[name] = cls known_events[name] = cls
class DelugeEvent(object): class DelugeEvent(object):
""" """
The base class for all events. The base class for all events.
@ -75,6 +77,7 @@ class DelugeEvent(object):
name = property(fget=_get_name) name = property(fget=_get_name)
args = property(fget=_get_args) args = property(fget=_get_args)
class TorrentAddedEvent(DelugeEvent): class TorrentAddedEvent(DelugeEvent):
""" """
Emitted when a new torrent is successfully added to the session. Emitted when a new torrent is successfully added to the session.
@ -88,6 +91,7 @@ class TorrentAddedEvent(DelugeEvent):
""" """
self._args = [torrent_id, from_state] self._args = [torrent_id, from_state]
class TorrentRemovedEvent(DelugeEvent): class TorrentRemovedEvent(DelugeEvent):
""" """
Emitted when a torrent has been removed from the session. Emitted when a torrent has been removed from the session.
@ -99,6 +103,7 @@ class TorrentRemovedEvent(DelugeEvent):
""" """
self._args = [torrent_id] self._args = [torrent_id]
class PreTorrentRemovedEvent(DelugeEvent): class PreTorrentRemovedEvent(DelugeEvent):
""" """
Emitted when a torrent is about to be removed from the session. Emitted when a torrent is about to be removed from the session.
@ -110,6 +115,7 @@ class PreTorrentRemovedEvent(DelugeEvent):
""" """
self._args = [torrent_id] self._args = [torrent_id]
class TorrentStateChangedEvent(DelugeEvent): class TorrentStateChangedEvent(DelugeEvent):
""" """
Emitted when a torrent changes state. Emitted when a torrent changes state.
@ -123,12 +129,14 @@ class TorrentStateChangedEvent(DelugeEvent):
""" """
self._args = [torrent_id, state] self._args = [torrent_id, state]
class TorrentQueueChangedEvent(DelugeEvent): class TorrentQueueChangedEvent(DelugeEvent):
""" """
Emitted when the queue order has changed. Emitted when the queue order has changed.
""" """
pass pass
class TorrentFolderRenamedEvent(DelugeEvent): class TorrentFolderRenamedEvent(DelugeEvent):
""" """
Emitted when a folder within a torrent has been renamed. Emitted when a folder within a torrent has been renamed.
@ -144,6 +152,7 @@ class TorrentFolderRenamedEvent(DelugeEvent):
""" """
self._args = [torrent_id, old, new] self._args = [torrent_id, old, new]
class TorrentFileRenamedEvent(DelugeEvent): class TorrentFileRenamedEvent(DelugeEvent):
""" """
Emitted when a file within a torrent has been renamed. Emitted when a file within a torrent has been renamed.
@ -159,6 +168,7 @@ class TorrentFileRenamedEvent(DelugeEvent):
""" """
self._args = [torrent_id, index, name] self._args = [torrent_id, index, name]
class TorrentFinishedEvent(DelugeEvent): class TorrentFinishedEvent(DelugeEvent):
""" """
Emitted when a torrent finishes downloading. Emitted when a torrent finishes downloading.
@ -170,6 +180,7 @@ class TorrentFinishedEvent(DelugeEvent):
""" """
self._args = [torrent_id] self._args = [torrent_id]
class TorrentResumedEvent(DelugeEvent): class TorrentResumedEvent(DelugeEvent):
""" """
Emitted when a torrent resumes from a paused state. Emitted when a torrent resumes from a paused state.
@ -181,6 +192,7 @@ class TorrentResumedEvent(DelugeEvent):
""" """
self._args = [torrent_id] self._args = [torrent_id]
class TorrentFileCompletedEvent(DelugeEvent): class TorrentFileCompletedEvent(DelugeEvent):
""" """
Emitted when a file completes. Emitted when a file completes.
@ -194,6 +206,21 @@ class TorrentFileCompletedEvent(DelugeEvent):
""" """
self._args = [torrent_id, index] self._args = [torrent_id, index]
class TorrentStorageMovedEvent(DelugeEvent):
"""
Emitted when the storage location for a torrent has been moved.
"""
def __init__(self, torrent_id, path):
"""
:param torrent_id: the torrent_id
:type torrent_id: string
:param path: the new location
:type path: string
"""
self._args = [torrent_id, path]
class CreateTorrentProgressEvent(DelugeEvent): class CreateTorrentProgressEvent(DelugeEvent):
""" """
Emitted when creating a torrent file remotely. Emitted when creating a torrent file remotely.
@ -201,6 +228,7 @@ class CreateTorrentProgressEvent(DelugeEvent):
def __init__(self, piece_count, num_pieces): def __init__(self, piece_count, num_pieces):
self._args = [piece_count, num_pieces] self._args = [piece_count, num_pieces]
class NewVersionAvailableEvent(DelugeEvent): class NewVersionAvailableEvent(DelugeEvent):
""" """
Emitted when a more recent version of Deluge is available. Emitted when a more recent version of Deluge is available.
@ -212,6 +240,7 @@ class NewVersionAvailableEvent(DelugeEvent):
""" """
self._args = [new_release] self._args = [new_release]
class SessionStartedEvent(DelugeEvent): class SessionStartedEvent(DelugeEvent):
""" """
Emitted when a session has started. This typically only happens once when Emitted when a session has started. This typically only happens once when
@ -219,18 +248,21 @@ class SessionStartedEvent(DelugeEvent):
""" """
pass pass
class SessionPausedEvent(DelugeEvent): class SessionPausedEvent(DelugeEvent):
""" """
Emitted when the session has been paused. Emitted when the session has been paused.
""" """
pass pass
class SessionResumedEvent(DelugeEvent): class SessionResumedEvent(DelugeEvent):
""" """
Emitted when the session has been resumed. Emitted when the session has been resumed.
""" """
pass pass
class ConfigValueChangedEvent(DelugeEvent): class ConfigValueChangedEvent(DelugeEvent):
""" """
Emitted when a config value changes in the Core. Emitted when a config value changes in the Core.
@ -243,6 +275,7 @@ class ConfigValueChangedEvent(DelugeEvent):
""" """
self._args = [key, value] self._args = [key, value]
class PluginEnabledEvent(DelugeEvent): class PluginEnabledEvent(DelugeEvent):
""" """
Emitted when a plugin is enabled in the Core. Emitted when a plugin is enabled in the Core.
@ -250,10 +283,10 @@ class PluginEnabledEvent(DelugeEvent):
def __init__(self, plugin_name): def __init__(self, plugin_name):
self._args = [plugin_name] self._args = [plugin_name]
class PluginDisabledEvent(DelugeEvent): class PluginDisabledEvent(DelugeEvent):
""" """
Emitted when a plugin is disabled in the Core. Emitted when a plugin is disabled in the Core.
""" """
def __init__(self, plugin_name): def __init__(self, plugin_name):
self._args = [plugin_name] self._args = [plugin_name]