Skip to content

Instantly share code, notes, and snippets.

@phosphore
Created August 3, 2014 15:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phosphore/aed522da0a50602b8c19 to your computer and use it in GitHub Desktop.
Save phosphore/aed522da0a50602b8c19 to your computer and use it in GitHub Desktop.
A simple bash script that uses google's tts service to notify new emails. [IT-it]
#!/bin/bash
rm /home/pi/bash/tmp/atom
wget --no-check-certificate -q -P/home/pi/bash/tmp/ https://user:pswd@mail.google.com/mail/feed/atom
email=$((`perl -ne 'while(/author/g){++$count}; print "$count\n"' /home/pi/bash/tmp/atom`/2))
sender=`grep -oPm1 "(?<=<name>)[^<]+" /home/pi/bash/tmp/atom | tr '\n' ','`
echo $sender
if [ "$email" == 1 ]; then
email=$email
mpg123 -q attention.mp3
/bin/bash ./speech2text.sh "C'è una nuova mail da $sender ."
elif [ -n "$email" ]; then
email=$email
mpg123 -q attention.mp3
/bin/bash ./speech2text.sh "Ci sono $email nuove mail da: $sender ."
email=0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment