Support for issuing callbacks in response to Plex websocket updates.
Project description
python-plexwebsocket
Async library to react to events issued over Plex websockets.
Example use
import asyncio
import logging
from plexapi.server import PlexServer
from plexwebsocket import PlexWebsocket, SIGNAL_CONNECTION_STATE
logging.basicConfig(level=logging.DEBUG)
baseurl = 'http://<PLEX_SERVER_IP>:32400'
token = '<YOUR_TOKEN_HERE>'
plex = PlexServer(baseurl, token)
def print_info(msgtype, data, error):
if msgtype == SIGNAL_CONNECTION_STATE:
print(f"State: {data} / Error: {error}")
else:
print(f"Data: {data}")
async def main():
ws = PlexWebsocket(plex, print_info, subscriptions=["playing", "status"])
await ws.listen()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
plexwebsocket-0.0.14.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for plexwebsocket-0.0.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f00aa36a42908ca16a8c5a79ddbb99e9b9d98538636a41eb2666edcb85b6141c |
|
MD5 | 6e457dec2cfe8b9263f1140b7edc66d6 |
|
BLAKE2b-256 | 3d87b52611c5009f5b3d1025eec28dbcf04a5a8ddac2883a935a535986bbff09 |