Async Mopidy Client via JSON/RPC Websocket interface
Project description
Mopidy-Async-Client
Fork of Mopidy-json-client, but from scratch and async
Async Mopidy Client via JSON/RPC Websocket interface
Usage
mopidy-async-client provides a main class MopidyClient
, which manages the connection and methods to the Mopidy Server.
import asyncio
from mopidy_async_client import MopidyClient
async def playback_started_handler(**data):
print(data)
async def all_events_handler(event, **data):
print(event, data)
async def main1():
async with MopidyClient() as mopidy: # close connection explicit
await mopidy.playback.play()
async def main2():
mopidy = await MopidyClient().connect()
mopidy.listener.bind('track_playback_started', playback_started_handler)
mopidy.listener.bind('*', all_events_handler)
# your app logic
for i in range(10):
await asyncio.sleep(5)
# end your app logic
await mopidy.disconnect() # close connection implicit
asyncio.run(main1())
# or
asyncio.run(main2())
Installation
pip install mopidy-async-client
References
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
mopidy-async-client-0.2.2.tar.gz
(10.6 kB
view hashes)
Built Distribution
Close
Hashes for mopidy-async-client-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 581662dcd1c05e6c7a3602489438af333bad45005c6a032233582121e2edd05d |
|
MD5 | 375fe71744b9df4857390d8f571a7bff |
|
BLAKE2b-256 | 16c8b69abb12026b23887e557b8aa6b1100232faca5e1dd148458d3017107a28 |
Close
Hashes for mopidy_async_client-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e71b4455328fc7754bf572da3be5c1dae556bf398fd706676d736d8a10483c32 |
|
MD5 | f3818074f6e73ba77e8495398cef1d34 |
|
BLAKE2b-256 | 49845f232b1da6370e7212d9c7c25af820ed63986d2c6797987eb074ccb91111 |