-
-
Save ybonnel/2820598 to your computer and use it in GitHub Desktop.
Say each tweet when it arrives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
lines_to_skip=`t timeline | wc -l | sed 's/^ *//g'` | |
i=0 | |
echo Skipping [$lines_to_skip] lines in the timeline | |
echo From now on, say each tweet as soon as it arrives... | |
t stream timeline | while read -r line; do | |
i=`expr $i + 1` | |
if [ $i -ge $lines_to_skip ]; then | |
echo "$line" | |
# Substitute RT by Reuh Twitte to have good voice | |
line=`echo $line | sed "s/RT /Reuh Twitte /"` | |
# Substitute tweet by twitte to have good voice | |
line=`echo $line | sed "s/tweet/twitte/"` | |
# Delete of links | |
line_final="" | |
for mot in $line | |
do | |
HTTP_FIND=`echo $mot | grep 'http://' | wc -l` | |
HTTPS_FIND=`echo $mot | grep 'https://' | wc -l` | |
if [ $HTTP_FIND -eq 0 -a $HTTPS_FIND -eq 0 ] | |
then | |
line_final="$line_final $mot" | |
fi | |
done | |
say -v Sebastien "$line" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment