You are not logged in.
Pages: 1
Hi
I'm often looking for songs using the find command, copying the result with my dear mouse and playing it in mplayer - how do I automate this a bit, piping it into mplayer automatically?
output
michael@swamp ~/music> find . -iname '*damer*'
./VA-Dance_Chart_Vol_24-2CD-2009-pLAN9/122-julian-damer.mp3
Thanks
Last edited by valvet (2010-11-04 13:10:52)
Offline
find . -iname '*damer*' -print0 | xargs -0 mplayer
Offline
find . -iname '*damer*' -print0 | xargs -0 mplayer
Excellent, thank you!
Offline
I use this:
[karol@black ~]$ type musa
musa is a function
musa ()
{
find /home/karol/music/ -type f -iname "*$1*" -iname "*$2*" -exec mplayer '{}' \;
}
Offline
I use this:
[karol@black ~]$ type musa musa is a function musa () { find /home/karol/music/ -type f -iname "*$1*" -iname "*$2*" -exec mplayer '{}' \; }
That is great! I wonder, how could I change that find line so that the directory/location being searched is also a variable?
Offline
That is great! I wonder, how could I change that find line so that the directory/location being searched is also a variable?
You mean like this:
find "$1" -type f -iname "*$2*" -iname "*$3*" -exec mplayer '{}' \;
?
Of course it can be $3, $1, $2 if you first want to say what to look for and next where.
'Find' looks in subfolders and I have all my music in one place, plus I don't want t type things like '/home/karol/blah/foo/bar' every time. If your paths look like this, you can add some variables to this function so that you write e.g. 'musa $music killer queen' and not 'musa /home/karol/music/ killer queen'.
If you don't know how to do this, just ask.
Last edited by karol (2010-11-04 19:34:16)
Offline
Clever looking function, I'll try that out - thanks alot :-)
Offline
Pages: 1