Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Unnamed
Saturday, April 14th, 2007 at 11:01:51pm UTC 

  1. #!/bin/sh
  2.  
  3.  
  4. ##  first i check that we have a player.     i use sox.
  5. ##  if you use something else set this to match your player
  6. [ -z sox ] && echo "install sox" && exit 1
  7.  
  8. if [ -f "$1" ]
  9.   then # simply play the sound file. else look for sub-dirrectories
  10.     if echo "$1" | grep -ie 'cdrom' > /dev/null 2>&1
  11.          # if it's on the cdrom drive then set the speed to 1X
  12.         then eject -x 1 /dev/cdrom > /dev/null 2>&1
  13.     fi > /dev/null 2>&1
  14.     play "$1" > /dev/null 2>&1
  15.      # i didn't like the scrolling numbers sox displays so it's nulled.
  16.   elif [ -d "$1" ]
  17.     then # for directories, play all audio files within.
  18.         LIST="`find $1 -type f`"
  19.         C='1'
  20.         BOB="`for Q in $LIST
  21.                 do if file $Q | grep audio > /dev/null 2>&1
  22.                     then echo "$RANDOM:$Q"
  23.                   fi
  24.             done | sort | cut -d':' -f2- `"
  25.     for NEXT in $BOB
  26.         do echo "#$C    Now playing,    \"`basename "$NEXT"`\" "
  27.             $0 "$NEXT" > /dev/null 2>&1
  28.             C="$(($C + 1))"
  29.     done
  30.   else find ~/ /usr/local/ -name $1 -exec play '{}' \;
  31. fi

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right