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.3.tar.gz
(10.6 kB
view hashes)
Built Distribution
Close
Hashes for mopidy-async-client-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee257a4efa542802753b9246c5e01b1ffc2d7a3dd1ea9b5dfdcdb555832e0fcf |
|
MD5 | 899bfbce92e83cb7dece60f1f4291810 |
|
BLAKE2b-256 | eb98ceeb33a2ddc7bf8c332f05b94d9a535c79a5b7bb74e81b2d17c642dc721d |
Close
Hashes for mopidy_async_client-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75de9ce50bac60be14114cdf9dbfd32668bf7a054d1a6eff899c5313bce03af4 |
|
MD5 | 7e339c15939a2e66a7b9e1b818f73479 |
|
BLAKE2b-256 | 9161f6f2840bfc357f9ece6e3a56b619f81b01d004cc3595a6550e12dbb79756 |