Music Player Daemon Community Wiki

525pages on
this wiki
Add New Page
Add New Page Talk0

A python script which plays a random album from the current MPD playlist. It can also be run as a daemon, where at the end of an album it will select an album from the current playlist at random.  It does this by monitoring track changes, detecting the end of an album, and then then selecting a new album from the playlist.

The basic idea is to load up your MPD playlist with albums, and then run this script as a daemon.  When one album finishes, a new album will be chosen at random from the playlist. Similar to amarok's album shuffle mode or foobar2000's random album mode.

Depends: python-mpd

Get it here:

This script picks a random album from the MPD playlist.  Called with no
args it will pick a random album from the current playlist and start

It can also monitor MPD and select a new album in the playlist after the
last song on an album has ended. Use the -d option

   -d|--daemon  : daemon.  Monitor MPD for track changes. At end of album select
                  a new random album from the playlist
   -D|--debug   : Print debug messages to stdout
   -p|--passive : testing only. Don't make any changes to the MPD playlist



1. Select a new album to play from the current playlist (exits immediately):


2. Start as a daemon, logging output to /tmp/mpd-random-pl-album.log

( -d > /tmp/mpd-random-pl-album.log 2>&1 ) &

The album switching is currently triggered when we hit the last song on an album.  If the user changes the current song selection during the last song on an album then this script will kick in, randomly selecting a new album to play (i.e., it won't play the newly selected song).  Unfortunately I don't see how to avoid this unless I was to time how long the last song has been playing for, and compare it to the song length given by MPD.

Also on Fandom

Random Wiki