Advertisement
Guest User

smuttyhorsewav.sh

a guest
Feb 20th, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.72 KB | None | 0 0
  1. #!/bin/bash
  2. #Downloads, plays, and optionally deletes AI-generated wav files
  3. # when given a link, e.g.https://u.smutty.horse/ltnxohwbnsz.wav
  4. NAME=`echo ${1} | cut -d/ -f4`
  5. TYPE=`echo $NAME | cut -b 13-`
  6. if [ -f $NAME ] ; then echo "File exists, skipped dl" ; else  wget "${1}" ; fi
  7. EXIT=false
  8. if [ "$TYPE" = 'wav' ]; then PLAYER="play"
  9. elif [ "$TYPE" = 'mp3' ]; then PLAYER="mpg321"
  10.  else PLAYER="echo"
  11.  fi
  12. echo File is a $TYPE - Selected player: $PLAYER
  13. if [ "$PLAYER" = "" ]; then exit ; fi
  14. zenity --info --text="Ready to play"
  15. while [ $EXIT = false ]; do
  16.  $PLAYER $NAME
  17.  zenity --question --text="Replay or remove ${NAME}?" --ok-label="Delete file" \
  18.  --cancel-label="Play again" && EXIT=true
  19. done
  20. rm ${NAME}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement