22Apr/102
MPC Script – Quickly Find and Play by Album
This is a simple script for MPD & MPC users. It allows you to quickly queue and play an album. I name the script "album" and put it in ~/bin (which is included in my $PATH).
#!/bin/bash ## Shortcut to search, add, and play an album (after clearing current playlist). ## Use -a (for "add") to add the album to the playlist without clearing current playlist. if [ $1 = -a ] then shift mpc search album "$*" | mpc add ; mpc play exit fi mpc clear mpc search album "$*" | mpc add ; mpc play
The usage is simple:
album abbey
The above command would stop the song currently playing, clear the current playlist and replace it with The Beatles' Abbey Road, and start playing it. If I had another album with "abbey" in the name, it would have loaded that one as well. Spaces are included as part of the search string -- for example, this also works:
album abbey road
You can use the "-a" switch to add the album to the current playlist. It won't interrupt what's currently playing, it will only put the new album in the queue.
album -a abbey road
October 14th, 2010 - 23:44
Handy Script Thanks!
October 16th, 2010 - 15:15
Glad it was helpful.