python-musicpd socket timeout

Having socket timeout enabled can help to detect “half-open connection”. For instance loosing connectivity without the server explicitly closing the connection (switching network, router down, MPD stuck|crashing, etc…).

A timeout was introduced in v0.6.0 for the initial MPD connection (connect command), then the socket is put in blocking mode with no timeout. Its value is set in musicpd.CONNECTION_TIMEOUT at module level (overridden by MPD_TIMEOUT environment variable following MPD recommendations).

Latest commit 0c16ca07 added the possibility to set a socket timeout for the next call/response to MPD after the initial connect.

This is not released yet. Please test if you are using this module as part of your projects. The sphinx documentation is up-to-date, not online though, need to be build.

Here are some lines of python to test the feature using select.select.

Happy Music Player Daemon hacking with python 🐍 :)
Happy listening 🎶!