find and play music - quickest way !!

So you are the one who loves music and has more than thousand of songs saved in your system.This script is going to make your life a hell lot easier!! Too much song in your drive makes it hard to find and play the song you want.You can avoid a lot of double-clicks with this really simple script.

Make sure you've got mplayer installed. If not run sudo apt-get install mplayer ( Ubuntu ) in terminal or install it through Software Center ( Ubuntu ) or Add/Remove Software ( Fedora ).

Nothing much to explain.The script is pretty self explaining.


# for finding and executing music in mplayer
# replace '/my/Music/Collection/'with real path of the folder your music is stored. '/*/*/*' are given to look into sub folders


#for playing all songs in shuffled manner
if [[ "$song" == "all" ]];then
mplayer -shuffle /my/Music/Collection/* /my/Music/Collection/*/* /my/Music/Collection/*/*/* /my/Music/Collection/*/*/*/* /my/Music/Collection/*/*/*/*/* /my/Music/Collection/*/*/*/*/*/*
#for finding and playing the song name given
find /my/Music/Collection/ -type f -iname "*$song*" -exec mplayer {} \;


In my case the script is just named 'm' ( please keep that name so you don't have to type much ) . If I want to play , say Robbie Williams - Feel ,  I'll just type  m feel or m robbie or m 'anypart of the name of the song you remember ' and press enter . I've more than 2000 thousand songs in my drive and finding and playing it doesn't even take a second !!! 

    click on the image get larger view

If you have more than one song having the same name you given to m script , it will play all those songs one by one. If first song played is not what you intended then press Enter to go to next song or press Ctrl C to close the script and again execute with more details.

If you want to play all songs in your collection in shuffled manner execute m all.

Try it. You will fall in love with this script !!

Enjoy Linux !!

Don't know what to do with the codes ?? click here

1 comment:

  1. This is really a great script thank you very much for you work.