Wikia

Music Player Daemon Community Wiki

Hack:mpdshuf

Talk0
544pages on
this wiki

Small shellhack that will move songs around on your playlist. This was written in a few minutes and I'm not a bash guru, so bear with me.

I release this in an almost-PD license: copy it, edit it, change it, but please give credit, that's pretty much all I ask.

Code
#!/bin/bash

# mpcshuf.sh: "Shuffles" the mpd playlist.
# By Renan Birck, '09. 
# Last updated: 02/04/09.

UPPER=50 # How many times max. to shuffle?
HOWMANY=$RANDOM
let "HOWMANY %= $UPPER"

for X in `seq 0 $HOWMANY`; do
MAXSONG=`mpc playlist | tail -n 1 | awk '{print $1}' | sed 's/)//g'`;
RANFROM=$RANDOM;
RANTO=$RANDOM;


let "RANFROM %= $MAXSONG";
let "RANTO %= $MAXSONG";


mpc move $RANFROM $RANTO;
echo "Moved song " $RANFROM " to " $RANTO; # For debugging, remove if you want.
done

Author
renan.dream AT gmail.com
Advertisement | Your ad here

Photos

Add a Photo
138photos on this wiki
See all photos >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki