MPD client class¶
-
class
musicpd.MPDClient[source] MPDClient instance will look for
MPD_HOST/MPD_PORT/XDG_RUNTIME_DIRenvironment variables and set instance attributehost,portandpwdaccordingly.Then
musicpd.MPDClient.connectwill usehostandportas defaults if not provided as args.Cf.
musicpd.MPDClient.connectfor details.>>> from os inport environ >>> environ['MPD_HOST'] = 'pass@mpdhost' >>> cli = musicpd.MPDClient() >>> cli.pwd == environ['MPD_HOST'].split('@')[0] True >>> cli.host == environ['MPD_HOST'].split('@')[1] True >>> # cli.connect() will use host/port as set in MPD_HOST/MPD_PORT
-
connect(host=None, port=None)[source] Connects the MPD server
Parameters: The connect method honors MPD_HOST/MPD_PORT environment variables.
-
disconnect()[source] Closes the MPD connection. The client closes the actual socket, it does not use the ‘close’ request from MPD protocol (as suggested in documentation).
-