This release is a pre-release and may not be stable for production use.
py-music-assistant
A Python HTTP client and mediavocab bridge for a Music Assistant server.
It is the single transport and conversion layer shared by the OVOS Music Assistant integrations:
- ovos-media-plugin-mass: playback backend (
opm.media.audio) - ovos-media-provider-mass: catalog/search provider (
opm.media.provider) - ovos-skill-music-assistant: legacy OCP search skill
Install
pip install py-music-assistant
Usage
from py_music_assistant import SimpleHTTPMusicAssistantClient, search_to_releases
api = SimpleHTTPMusicAssistantClient("http://192.168.1.100:8095")
# raw search (dict of buckets: tracks/albums/artists/radio/podcasts/audiobooks)
res = api.search_media("viagra boys", limit=10)
# mapped to typed mediavocab.Release objects (unranked; score them yourself)
releases = search_to_releases(res)
for r in releases:
print(r.work.title, r.work.media_type, r.uri) # e.g. "Worms" MUSIC library://track/9903
The client talks to the server's synchronous JSON /api endpoint. It has no
WebSocket lifecycle. Item uri values are library://<type>/<id> identifiers.
The ovos-media-plugin-mass backend resolves and plays these identifiers.
Authentication
Music Assistant 2.11 and later requires every /api call to carry an access
token. Pass one explicitly, or set the MASS_TOKEN environment variable:
api = SimpleHTTPMusicAssistantClient("http://192.168.1.100:8095", token="<your-token>")
Create a long-lived token in the Music Assistant web UI under Settings → Users, on the user account the client should authenticate as.
Servers older than 2.11 have no authentication and keep working unchanged: if
no token is given (neither as an argument nor via MASS_TOKEN), the client
sends no Authorization header at all.
A call made without a token against a server that requires one raises
music_assistant_models.errors.AuthenticationRequired with the fix spelled
out in the message.
Docs
- docs/index.md: overview
- docs/client-api.md:
SimpleHTTPMusicAssistantClientreference - docs/mediavocab-bridge.md: dict to
Releasemapping
Tests
pip install -e .[test]
pytest test/ # unit + end2end, network-free (mocked + fixtures)
MASS_SERVER_URL=http://<host>:8095 pytest test/live/ # opt-in, against a real server
The end-to-end tests (test/end2end/) exercise the full round trip
this library owns: HTTP transport, then the Music Assistant /api protocol, then
the mediavocab bridge, then typed Release objects, all against a mocked server.
This is a transport library with no skills and no message bus, so ovoscope
end-to-end tests live in the consumers
(ovos-media-plugin-mass,
ovos-media-provider-mass,
ovos-skill-music-assistant).
License
Apache-2.0
Metadata
Release files for py-music-assistant 0.1.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_music_assistant-0.1.0a3.tar.gz | 17.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_music_assistant-0.1.0a3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.8 kB
Release files / py_music_assistant-0.1.0a3.tar.gz
| Download URL | py_music_assistant-0.1.0a3.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e936b9afec160cc1c4aee16dc4670fb5d834e0be652fd5e876ebe83f0699d5e3
|
|
BLAKE2b-256 checksum How to use checksums |
daf3e36751defdc8f8449c0a9af429662399925a79bc2b77e0e595a020421a91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / py_music_assistant-0.1.0a3-py3-none-any.whl
| Download URL | py_music_assistant-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84bfdad6dabb8c49e4fd040bde8c42546184f0978ede494b4fc5d63c10fd7dfb
|
|
BLAKE2b-256 checksum How to use checksums |
5c01c324a73844b02a62ef51707485b65032db69157ba2d821398f346f398f95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|