statusd_mpd-socket.lua

Marc Hartstein <[email protected]>
Newsgroups gmane.comp.window-managers.ion.general
Message-ID <1227063811-sup-2931@cabinet>
A drop-in replacement for statusd_mpd.lua which uses sockets instead of
popen to communicate with mpd.  Suggest renaming to replace the other
script.

Requires LuaSocket 
(http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/home.html)

I've been having difficulty with the existing statusd_mpd.  In
particular, the existing script frequently but fairly randomly causes
the statusbar to fail to load, necessitating multiple restarts of ion3
before it behaves properly.

This replacement sets a short timer at startup and exits quickly, which
seems to help with the problem I was experiencing: if it's slow to open
a connection to mpd, it will not bring down the entire statusbar.

It also follows Tuomo's suggestion of using sockets rather than running
a program with popen every half-second.  This should be less overhead
for the system.  It does tie up one of your mpd connections permanently,
however, so you may need to make sure max_connections is high enough to
support it.  If you're running out of connections, though, it's more
likely that you have a whole bunch of redundant ion-statusd processes
hanging out doing nothing.

I've also added %artist_or_album, which I use so tracks from Broadway
shows are displayed reasonably in my collection.  There might be a
better way to do this, but I haven't come up with anything I like.

Comments welcome, particularly if there are any situations in which it
can get hung up holding an open socket of which I'm unaware.
statusd_mpd-socket.lua (application/octet-stream, 5.7 KB) - not displayed
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkkjhXEACgkQSEext8NjodvV8ACaArkaZLax6lvYje1v3jgpBq6e
Pb8AnR6tDB5K+jtH0dXzhZ4waKYMw9kV
=CQLC
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.