mpdpopm provides two programs:
mppopmd
is the companion daemon process to MPD
mppopm
is the command-line interface to mppopmd
Both programs make use of the MPD
protocol, a
simple text-based protocol by which clients can communicate with the
MPD daemon and with one another. From the perspective of
MPD, mppopm
& mppopmd
are just new clients. Via
this protocol mppopmd
will monitor MPD for song playback
& note when songs complete; this is how it knows to increment the
playcount & update the last played timestamp for each song to which
you listen.
Also via the protocol, MPD clients can communicate with one
another by registering "channels" and subscribing to them; one client
can send a message to a given channel, and all other clients
subscribed to that channel will receive that message. In particular,
if an MPD client sends the "rating" command to the
mppopmd
commands channel (the channel name is configurable, but
defaults to "unwoundstack.com:commands"), mppopmd
will set the
rating for the given track.
The mechanism by which mppopmd
records this information (i.e
play counts, last played and ratings) is MPD
stickers. A sticker is a little bit of textual information which
clients can attach to songs in the form of a name-value
pair. mpdpopm
defines a new sticker name (again configurable)
for each of these items & udpates the values for each song when & as
requested.
Of course, other MPD clients will not, in general, be aware of
mppopmd
, its command channel, or the stickers it sets: you the
user will have to bridge that gap. You could of course just fire-up
netcat
& start sending commands, but that’s not particularly
convenient. That’s where mppopm
comes in. It is a small
command-line tool for controlling the mppopmd
daemon; you could
for instance say mppopm set-rating '*****'
to rate the
current track at five stars. Under the hood, it connects to the MPD
daemon, sends a "rating" message to the mppopmd
commands
channel, and mppopmd
, in turn, tells MPD to set the rating
sticker for the curren track to 255 (more on the rating system below).