* Ashley M. Kirchner [Sun, Feb 18, 2001 at 04:52:21PM -0700]:
> Dave Wreski wrote:
> 
> > while [ 1 ]
> > do
> >         for mp3 in `/bin/ls -AQU *.mp3`
> >         do
> >                 amp -p $mp3
> >         done
> > done
> 
>     Hrm, something's not right.
> 
>     a) If I do 'ls -AQU *.mp3', the result is always sorted.
>        However, if I just do 'ls -AQU' it's not sorted.
> 
>     b) Running the above doesn't work, and I think it has to do with
>        the way the files are setup:
> 
>         [ artist one ] song title one.mp3
>         [ artist one ] song title two.mp3
>         [ artist two ] song title one.mp3
> 
>     When I run the above snippet, I get amp trying to play this:
> 
>     amp -p [
>     amp -p artist
>     amp -p one
>     amp -p ]
>     amp -p song
>     ...
>     ...
> 
>     It's breaking it into individual pieces...
> 

With filenames like that things can get pretty cumbersome in bash,
so I suggest a perl script instead. Here's one I once created to 
generate shuffed playlists, somewhat adapted to this situation:

  #!/usr/bin/perl

  srand;
  for (;;)
  {
    @f = <*.mp3>;
    @s=();
    (push(@s,splice(@f,rand @f,1))) while (@f);
    map {system ("amp","-p",$_)} @s;
  }

It will loop ad inifinitum, playing all mp3 files in the working
directory randomly shuffled.

Hope that helps.

-- 
Johannes Eriksson <[EMAIL PROTECTED]>
Computer Science, AA University



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to