Wikia

Music Player Daemon Community Wiki

Hack:arthist-recent

525pages on
this wiki
Talk0

arthist is a great tool to display what tracks you've been playing with MPD. As the author notes, it appends info on the most recently played track to the bottom of the list. Here we'll see how to make the arthist script generate the list in reverse chronological order, e.g. with the most recent track on top. Since most of Perl is beyond me, we'll use an ugly hack with standard Unix/Linux tools to accomplish this.

First, look up

$laststatus=$newstatus;

in the arthist Perl script. It should be near line 411. Now add the following lines beneath this line:

system("cp $config{filename} $config{filename}.bak");
system("cp $config{filename}.blank $config{filename}");
system("cat $config{filename}.history >> $config{filename}.bak");
system("cp $config{filename}.bak $config{filename}.history");
system("cat $config{filename}.template $config{filename}.bak > $config{filename}.html")

$config{filename} refers to the filename you entered in the configuration section. I'd recommend you enter a no-dot string like 'kees' there so you'll end up with that string + an .html suffix for easy viewing in your browser; 'kees.html'. Make sure the 'kees', 'kees.bak', 'kees.history', 'kees.template' and 'kees.html' files exist and have correct permissions before running the script. Every file should be empty when first running the modified script, except for 'kees.template' which should hold the HTML header en CSS info. You can obtain the header and CSS by running the unmodified script and copying everything from <html> to and including --></style> from the output file into the 'kees.template' file.

Good luck, Wicher Minnaard.

Around Wikia's network

Random Wiki