mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Expose callbackError
parameter in PlexServer.startAlertListener()
(#985)
* Expose callbackError This makes it easier to catch errors without separately instantiating an AlertListener * Update docstring. * Fix docstring Removed post-argument note, incorporated suggestion.
This commit is contained in:
parent
3a56c69078
commit
a7e87a583f
1 changed files with 10 additions and 4 deletions
|
@ -753,21 +753,27 @@ class PlexServer(PlexObject):
|
|||
""" Returns a list of all active :class:`~plexapi.media.TranscodeSession` objects. """
|
||||
return self.fetchItems('/transcode/sessions')
|
||||
|
||||
def startAlertListener(self, callback=None):
|
||||
def startAlertListener(self, callback=None, callbackError=None):
|
||||
""" Creates a websocket connection to the Plex Server to optionally receive
|
||||
notifications. These often include messages from Plex about media scans
|
||||
as well as updates to currently running Transcode Sessions.
|
||||
|
||||
NOTE: You need websocket-client installed in order to use this feature.
|
||||
>> pip install websocket-client
|
||||
Returns a new :class:`~plexapi.alert.AlertListener` object.
|
||||
|
||||
Note: ``websocket-client`` must be installed in order to use this feature.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>> pip install websocket-client
|
||||
|
||||
Parameters:
|
||||
callback (func): Callback function to call on received messages.
|
||||
callbackError (func): Callback function to call on errors.
|
||||
|
||||
Raises:
|
||||
:exc:`~plexapi.exception.Unsupported`: Websocket-client not installed.
|
||||
"""
|
||||
notifier = AlertListener(self, callback)
|
||||
notifier = AlertListener(self, callback, callbackError)
|
||||
notifier.start()
|
||||
return notifier
|
||||
|
||||
|
|
Loading…
Reference in a new issue