Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Downloads, plays, and optionally deletes AI-generated wav files
- # when given a link, e.g.https://u.smutty.horse/ltnxohwbnsz.wav
- NAME=`echo ${1} | cut -d/ -f4`
- TYPE=`echo $NAME | cut -b 13-`
- if [ -f $NAME ] ; then echo "File exists, skipped dl" ; else wget "${1}" ; fi
- EXIT=false
- if [ "$TYPE" = 'wav' ]; then PLAYER="play"
- elif [ "$TYPE" = 'mp3' ]; then PLAYER="mpg321"
- else PLAYER="echo"
- fi
- echo File is a $TYPE - Selected player: $PLAYER
- if [ "$PLAYER" = "" ]; then exit ; fi
- zenity --info --text="Ready to play"
- while [ $EXIT = false ]; do
- $PLAYER $NAME
- zenity --question --text="Replay or remove ${NAME}?" --ok-label="Delete file" \
- --cancel-label="Play again" && EXIT=true
- done
- rm ${NAME}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement