It may be that the information managed by mpdpopm
is replicated
in other locations. For instance, the author has play counts
also recorded in the PCNT
& POPM
frames of the
ID3 tags attached to his music files, and ratings in the POPM
frame, as well. For that reason, mppopmd
has the ability to run
arbitrary commands after updating stickers. This feature was developed
for the purpose of keeping ID3 tags up-to-date, but one could do
anything (pop up a notification, update a database &c).
The operations of rating a song and of updating its play count (and
associated last played timestamp) may be configured to run an
arbitrary program whenever they are carried out. The two salient
options are rating_command and playcount_command,
respectively. If present in the mppopmd
configuration, they
should be the absolute path to the program to be executed.
Each has a partner option specifying the parameters that will be
supplied to the program when it is run (rating_command_args
and playcount_command_args, respectively). These options
shall be lists of command-line arguments to be provided, specified as
strings. Each may specify an argument of “%full-file” which will, on
command execution, be expanded by mppopmd
to the absolute path
of the song being operated upon.
rating_command_args may also make use of the “%rating” replacement parameter which will be expanded to the rating being applied (expressed as an integer between 0 & 255 inclusive expressed in base 10).
playcount_command_args may also employ the “%playcount” replacement parameter which will be the new play count (again expressed as an integer in base 10).
For example, the author has written an ID3 tagging utility called
scribbu which he uses
to keep his ID3 tags up-to-date. The following two lines, placed
in the mppopmd
configuration file, will cause it to invoke
the command /home/sp1ff/bin/scribbu popm -a -A -b -o sp1ff@pobox.com -C %playcount %full-file
every time it updates the play count sticker:
(playcount_command . "/home/sp1ff/bin/scribbu") (playcount_command_args . ("popm" "-a" "-A" "-b" "-o" "sp1ff@pobox.com" "-C" "%playcount" "%full-file"))
The tokens %playcount
& %full-file
will be replaced with
the new play count and the absolute path to the file backing the
current song, respectively.