I’ve been working on an mpdcron module to save mpd song data, like play count, to a local sqlite database. Build mpdcron like:

$> ./configure --enable-gmodule --with-standard-modules=all
$> make
$> sudo make install

Then add:

[main]
modules = stats

to your configuration file.

Of course just saving the data isn’t enough. We need a client to manipulate the data and interact with mpd using this data.

Thus eugene was born.

Usage:

First create your database:

$> eugene update
Updating /
Successfully processed 12283 songs

Note this phase is optional. All other eugene commands will create the database if it doesn’t exist.

Basic interaction with the database:

# Love/Hate/Kill/Unkill the current playing song
$> eugene love/hate/kill/unkill
# Love/Hate/Kill/Unkill the current playing artist
$> eugene love/hate/kill/unkill --artist
# Love/Hate/Kill/Unkill the current playing album
$> eugene love/hate/kill/unkill --album
# Love/Hate/Kill/Unkill the current playing genre
$> eugene love/hate/kill/unkill --genre
# Give the current playing song a rating of 10
$> eugene rate 10
# Increase the rating of the current playing song by 5
$> eugene rate --add 5
# Decrease the rating of the current playing song by 10
$> eugene rate --substract 10

Advanced interaction with the database using the –expr switch:

# Love all songs whose artist includes the string Beatles
$> eugene love --expr 'artist like "%Beatles%"'
# Hate all songs whose genre is Pop
$> eugene hate --expr 'genre="Pop"'
# Kill all songs whose duration is less than 10 seconds
$> eugene kill --expr 'duration < 10'
# Unkill all songs whose play count is more than 10
$> eugene unkill --expr 'play_count > 10'

For more information about the expression syntax see:
http://www.sqlite.org/lang_expr.html
To learn more about the database layout see:
src/gmodule/stats/stats-sqlite.c

Loading songs to mpd queue:

# Load all loved songs, exclude killed ones
$> eugene load --expr 'love > 0 and kill != 0'
# Clear the playlist and load all songs with a duration less than 30 seconds
$> eugene load --clear --expr 'duration < 30'

This is all very basic right now and possibly buggy.
If you’re interested please check it out and tell me about it! I plan to release mpdcron-0.3 after some testing.

Last but not least:
Careful with that axe, Eugene!
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!