Friday 3 August 2012

Terminal music player

For the past two months i have been using terminal(mplayer) to play my
songs, I found it quite interesting to use terminal to play music than
using some other applications. I learnt how to use mplayer and run
songs on it, everytime I had to select a song, then play it and run
the command

mplayer abc.mp3

Then came the issue of playing multiple songs, used

mplayer *.mp3

Then I wanted the songs to play in a random pattern(shuffle). For that
I created a playlist in the directory containing the .mp3 files and
ran command

 find -type f -iname \*.mp3 > demon.txt

and hence a playlist named demon.txt is created, I would run it using
the command

mplayer -shuffle -playlist demon.txt

this would play songs in shuffle pattern. I created a script to play
songs in shuffle. But there was a problem that the script would run
only if the Drive containing .mp3 files and the playlist was mounted,
and if the drive was unmounted it would show error. I then learnt to
Mount drive using terminal commands and making small changes, and made
a script that would play when the drive was unmounted. One can learn
how to mount a drive from terminal from
https://help.ubuntu.com/community/Mount/USB

Now i have finally made a script, that checks whether the .mp3
containing drive is mounted or not, if the drive is mounted it simply
plays song from the playlist demon.txt.
and if the drive is not mounted, the script would fetch another script
in my folders that would unmount the drive and then run the playlist
demon.txt.

Here is the script i use, kept in my home folder
http://202.164.53.122/~daman/scripts/hi.sh

And the other script I use to Mount
http://202.164.53.122/~daman/scripts/demon.sh


I am really happy, removed banshee and rhythm box from my system :D.

No comments:

Post a Comment