Display currently playing song from MPD or other music players in a sidebar widget.
Configuration is via file. On Unix-like systems (includding OSX?), the
file is read from
both exist, entries in the former override those in the latter. The
file format is the usual WIN.INI style, with sections denoted by
square brackets and items specified as
item = value. Normally, the
file will have two sections: the standard
[sgwpupdate] section and a
module specific section such as
The supported configuration items in
[sgwpupdate] section are:
blog - URL to WordPress blog, such as
password - simple password to allow updates, must match option in
module - name of python module to do player specific update.
logfile - full path to logfile (optional)
pidfile - full path to name of file where PID will be written, if
running in daemon mode. (optional)
The supported configuration items for the
[sgwpmpd] module section are:
mpdhost - name of host where MPD is running, eg
mpdport - TCP port number for MPD. Almost always 6600.
Write a Python module containing a function name
getsong that takes
a single argument, which will be a dictionary of the config items from
the module-specific configuration section. The function should return
a tuple of (remainingtime, songdata). The
remainingtime value sets
sgwpupdate.py will wait before checking again in daemon
mode. The dictionary
songdata should contain the following keys:
artist - song performer or writer.
title - song title.
album - album title for the song.
state - current state of the player, should be one of 'play',
'pause', or 'stop'.
Your best bet is probably to copy
sgwpmpd.py and work from there.