Registry / devops / python-mpd2

python-mpd2

JSON →
library3.1.1pypypi✓ verified 86d ago

python-mpd2 is a Python client library for the Music Player Daemon (MPD) protocol. It provides both synchronous and asynchronous interfaces for controlling MPD. Current stable version is 3.1.1, released in 2023. It is actively maintained with regular releases.

pip install python-mpd2
INSTALL
IMPORT
SIG · PYTHON-MPD2
P
python-mpd2
devopspythonv3.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MPDClient
from mpd import MPDClient
import mpd
Direct import of mpd gives module, not client class
MPDClient
from mpd import MPDClient
from mpd2 import MPDClient
Old package name used in early versions

Connect to a local MPD server and retrieve status.

from mpd import MPDClient client = MPDClient() client.connect("localhost", 6600) status = client.status() print(status) client.close() client.disconnect()
Debug
Known issues
breakingIn version 3.0, the library dropped support for Python 2.7 and removed deprecated methods like `idle()` (replaced by `send_idle`).
fix
Upgrade to 3.x and use `send_idle` instead of `idle`.
affects: <3.0
gotchaDo not reuse the same MPDClient instance after calling disconnect(). Create a new client object.
fix
Always instantiate a fresh MPDClient after a disconnect.
affects: all
deprecatedThe `play()` method without arguments is deprecated; use `play(0)` to start from track 0.
fix
Use `client.play(0)` or specify a song number.
affects: >=3.0
Errors
Common errors & fixes
ConnectionRefusedError: [Errno 111] Connection refused
MPD server is not running or not reachable on the specified host/port.
fix
Ensure MPD is running and listening on the expected address/port.
mpd.ConnectionError: [Errno 32] Broken pipe
Connection to MPD was lost due to server restart or network issue.
fix
Reconnect by creating a new MPDClient and calling connect() again.
Upgrade
Version history
3.1.1latest on PyPI · released Jan 13, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
python-mpd2 — pip install python-mpd2 · libregistry