Guest User

ungulation

a guest
Sep 20th, 2009
205
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.  
  3. #set up file names and such
  4. PAGE=reddit.com/.json
  5. TEMPFILENEW=speaker.tmp
  6. TEMPFILEOLD=speakerprev.tmp
  7. DIFFFILE=diff.tmp
  8. SPEAKME=speakthis.tmp
  9.  
  10. #overwrite the old headlines with the newer ones
  11. mv $TEMPFILENEW $TEMPFILEOLD
  12.  
  13. #get the latest news and make it readable
  14. wget --quiet $PAGE -O $TEMPFILENEW
  15. sed -i 's/created_utc/\n/g' $TEMPFILENEW
  16. sed -i 's/^.*title"://g' $TEMPFILENEW
  17. sed -i 's/^.*}}//g' $TEMPFILENEW
  18. sed -i 's/[\"|\\|,$]//g' $TEMPFILENEW
  19.  
  20. #now figure out what has changed since our last update
  21. diff -iw $TEMPFILEOLD $TEMPFILENEW > $DIFFFILE
  22. egrep   '^>' $DIFFFILE > $SPEAKME
  23. sed -i 's/^>//g' $SPEAKME
  24.  
  25. #print it out and speak it
  26. echo "The latest headlines:"
  27. cat $SPEAKME
  28. espeak -f $SPEAKME
Add Comment
Please, Sign In to add comment