Reference¶
Environment variables¶
mpdaio.MPDClient honors the following environment variables:
- MPD_HOST¶
MPD host (FQDN, IP, socket path or abstract socket) and password.
To define a password setMPD_HOSTto “password@host” (password only “password@”)For abstract socket use “@” as prefix : “@socket” and then with a password “pass@@socket”Regular unix socket are set with an absolute path: “/run/mpd/socket”
- MPD_PORT¶
MPD port, relevant for TCP socket only
- MPD_TIMEOUT¶
socket timeout when connecting to MPD and waiting for MPD’s response (in seconds)
- XDG_RUNTIME_DIR¶
path to look for potential socket
Default settings¶
- Default host:
use
MPD_HOSTenvironment variable if set, extract password if present,else looks for an existing file in
${XDG_RUNTIME_DIR:-/run/}/mpd/socketelse set host to
localhost
- Default port:
use
MPD_PORTenvironment variable if setelse use
6600
- Default timeout:
use
MPD_TIMEOUTif setelse use
mpdaio.const.CONNECTION_TIMEOUT
Supported commands¶
Status Commands¶
clearerror
currentsong
idle
noidle
status
stats
Playback Option Commands¶
consume
crossfade
mixrampdb
mixrampdelay
random
repeat
setvol
getvol
single
replay_gain_mode
replay_gain_status
volume
Playback Control Commands¶
next
pause
play
playid
previous
seek
seekid
seekcur
stop
Queue Commands¶
add
addid
clear
delete
deleteid
move
moveid
playlist
playlistfind
playlistid
playlistinfo
playlistsearch
plchanges
plchangesposid
prio
prioid
rangeid
shuffle
swap
swapid
addtagid
cleartagid
Stored Playlist Commands¶
listplaylist
listplaylistinfo
listplaylists
load
playlistadd
playlistclear
playlistdelete
playlistlength
playlistmove
rename
rm
save
Database Commands¶
albumart
count
getfingerprint
find
findadd
list
listall
listallinfo
listfiles
lsinfo
readcomments
readpicture
search
searchadd
searchaddpl
searchcount
update
rescan
Mounts and neighbors¶
mount
unmount
listmounts
listneighbors
Sticker Commands¶
sticker get
sticker set
sticker delete
sticker list
sticker find
stickernames
Connection Commands¶
close
kill
password
ping
binarylimit
tagtypes
tagtypes disable
tagtypes enable
tagtypes clear
tagtypes all
Partition Commands¶
partition
listpartitions
newpartition
delpartition
moveoutput
Audio Output Commands¶
disableoutput
enableoutput
toggleoutput
outputs
outputset
Reflection Commands¶
config
commands
notcommands
urlhandlers
decoders
Client to Client¶
subscribe
unsubscribe
channels
readmessages
sendmessage
Module documentation¶
MPDClient class¶
- class mpdaio.client.MPDClient(host=None, port=None, password=None)[source]¶
- Synopsis:
Main class to instanciate building an MPD client.
- Parameters:
musicpdaio tries to come with sane defaults, then running
mpdaio.MPDClientwith no explicit argument will try default values to connect to MPD. Cf. Reference for more about defaults.The class is also exposed in mpdaio namespace.
>>> import mpdaio >>> cli = mpdaio.MPDClient(host='example.org') >>> print(await cli.currentsong()) >>> await cli.close()
- mpd_timeout¶
connection timeout
Constants¶
- mpdaio.const.CONNECTION_TIMEOUT = 30¶
Seconds before a connection attempt times out (overriden by
MPD_TIMEOUTenv. var.)
- mpdaio.const.CONNECTION_MAX = 100¶
Maximum concurrent connections