Reputation: 6643
I wrote a small shell script that plays music when ever I call it.
function playmusic() {
find /music/path -type f -name "*.mp3" -exec mplayer {} \;
}
and added it to my .zshrc
file, so now I can play music by calling playmusic
.
If I am working with multiple tabs I had to search the tab where I am playing the music, but if I know how can I send arguments to playmusic
function PID then I can control it from any terminal.
any suggestions greatly appreciated.
Thank you.
Upvotes: 0
Views: 101
Reputation: 16761
You can use slave mode: http://www.mplayerhq.hu/DOCS/tech/slave.txt
For example:
mkfifo ~/.mplayer/fifo
function playmusic(){
find /music/path -type -name "*.mp3" -exec \
mplayer -really-quiet -slave -input file=~/.mplayer/fifo {} \;
}
function mmute(){
echo m > ~/.mplayer/fifo
}
function mquit(){
echo q > ~/.mplayer/fifo
}
Upvotes: 2