Tuesday, August 10, 2010

Twitter speaking in Ubuntu


#!/bin/bash
if [ $# -eq 0 ];
then
    User=????????
    Password=????????
    Url=https://twitter.com/statuses/home_timeline.xml
    Command="bash $0 \""
    curl -u $User:$Password $Url -s | \
    grep "<text>" | \
    sed "s/<text>/$Command/g" | \
    sed 's/<\/text>/"/g' | \
    bash
else
    file=$(echo "$1" | md5sum | awk '{print $1}')
    if [ ! -d ~/.twitter ];
    then
        mkdir ~/.twitter
    fi
    if [ ! -f ~/.twitter/$file ];
    then
        touch ~/.twitter/$file
        echo "$1"
        espeak "$1"
    fi
fi

No comments:

Post a Comment