An MPD (Music Player Daemon) client library.

Description

python-musicpd is a fork of (now defunct) python-mpd.

It is supporting python3 ≥ 3.2 only.

Usage

>>> import musicpd
>>> client = musicpd.MPDClient()       # create client object
>>> client.connect()                   # use MPD_HOST/MPD_PORT env. vars if set else
                                       #   test ${XDG_RUNTIME_DIR}/mpd/socket for existence
                                       #   fallback to localhost:6600
                                       # connect support host/port argument as well
>>> print(client.mpd_version)          # print the mpd protocol version
'0.21.11'
>>> print(client.currentsong())
{'file': 'muse/Dave Grohl/2018-Play/01-Dave Grohl - Play.flac',
 'last-modified': '2018-10-09T16:51:03Z',
 'date': '2018',
 'track': '1',
 'label': 'Roswell Records',
 ...
 'musicbrainz_artistid': '4d5f891d-9bce-45ae-ad86-912dd27252fa',
 'album': 'Play',
 ...
 'time': '1356',
 'duration': '1356.000',
 'pos': '1',
 'id': '483'}
>>> client.disconnect()                # disconnect from the server