Re: bash scripting: mplayer command line playlist

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Eric \"Shubes\"
Date:  
To: plug-discuss
Subject: Re: bash scripting: mplayer command line playlist
Nathan England wrote:
> On Friday 18 February 2005 10:25, Eric "Shubes" wrote:
>
>>Mike Hoy wrote:
>>
>>>assuming i want to use mplayer in command line only how can i make a
>>>shell script that plays all of my music files in my music/ directory
>>>w/out having to specify each sub directory?
>>>
>>>So far I got this working:
>>>
>>>a file called playlist.sh:
>>>mplayer -shuffle band1/*.mp3 band2/*mp3 band3/*.mp3
>>>
>>>this playlist would be fine, but often i add or remove sub dirs from
>>>w/in my music/ directory
>>>
>>>and I specify *.mp3 so mplayer doesn't try to play anything buy mp3's
>>>
>>>thx
>>>
>>>mike hoy
>>
>>find music/ -name '*.mp3' -exec mplayer -shuffle {} \;
>>
>>Note, you probably want to add the full path to your music/ directory.
>
>
> This would tell mplayer to shuffle the 1 song it sent, right?


Bsst. Wrong.

> This would pull each file, in alphabetical order, then tell mplayer to play
> it. It wouldn't shuffle.


Bsst. Wrong again.

> If find creates a list, then mplayer gets the list,
> it will shuffle through the whole list...


Ding Ding Ding!
Bingo.

{} represents the list given to the -exec'd program. Pretty much the
same as piping to xargs.

>
>>find is very powerful. There is a whole slew of qualifiers you can
>>specify to tailor the files you want to find. Of course, see man find.
>


-- 
-Eric 'shubes'
"There is no such thing as the People;
  it is a collectivist myth.
  There are only individual citizens
  with individual wills
  and individual purposes."
-William E. Simon (1927-2000),
     Secretary of the Treasury (1974-1977)
  "A Time For Truth" (1978), pg. 237



---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss