SHARE
TWEET

steve54301

a guest Aug 13th, 2008 183 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. #
  3. # Determines the ice cream flavor of the day by reading a webpage, and
  4. # converts text to speech, to be read over an Asterisk Telephone extension
  5. # or similar.
  6. #
  7. #[custom-icecream]
  8. #exten => s,1,Answer
  9. #exten => s,2,System(/usr/local/bin/icecream)
  10. #exten => s,3,Wait(1)
  11. #exten => s,4,MP3Play(/tmp/flavor.mp3)
  12. #exten => s,5,hangup
  13. #
  14. #
  15. #URLS
  16. #http://www.zestyscustard.com/custard.php
  17. #http://www.storheimswest.com/flavor/index.php
  18. ##########
  19. #Clean-Up#
  20. ##########
  21. /bin/rm -f /tmp/flavor.* > /dev/null 2>&1
  22. #
  23. echo "I scream for ice cream, we all scream for ice cream." >> /tmp/flavor.txt
  24. TODAY=`date "+%A %B %d"`
  25. echo $TODAY. >> /tmp/flavor.txt
  26. #
  27. ZDOW=`date "+%A"`
  28. ZDAY=`date "+%e"`
  29. ZESTYS=`lynx --dump http://www.zestyscustard.com/custard.php |grep -A4 "$ZDOW" | grep -A2 "$ZDAY" | tail -1 |cut -d " " -f4-20`
  30. echo The flavor at Zestys today is: $ZESTYS. >> /tmp/flavor.txt
  31. #
  32. SDATE=`date "+ %B %d"`
  33. STORHEIMS=`lynx --dump http://www.storheimswest.com/flavor/index.php | grep "$SDATE" |cut -d " " -f7-11`
  34. echo "The flavor at Storheims West today is: $STORHEIMS." >> /tmp/flavor.txt
  35. #
  36. #screen output for dubugging
  37. #cat /tmp/flavor.txt
  38. #
  39. #############################
  40. # Convert to wav & misc stuff
  41. #############################
  42. /opt/swift/bin/swift -f /tmp/flavor.txt -o /tmp/flavor.wav > /dev/null 2>&1
  43. lame --silent --scale 2.5 --abr 32 -m m -h /tmp/flavor.wav /tmp/flavor.mp3
  44. #
  45. exit 0
RAW Paste Data
Want to get better at Bash?
Learn to code Bash in 2017
Top