Friday, 12 August 2005

11:29am: Cricket tip of the day
Personally, I don't like cricket. But the following is keeping the office happy without resorting to radio commentary:

SCORE=""; while :; do \
NEWSCORE=$(wget -qO - \
http://newsimg.bbc.co.uk/sport1/shared/bsp/hi/cricket/in_vision/html/in_vision1.stm \
| sed -n 's/^.*<title>//p' | awk '{print $2}' | sed 's/-/, for /'); \
if [ "$NEWSCORE" != "$SCORE" ]; then \
	SCORE="$NEWSCORE"; \
	echo [$(date +%H:%M:%S)] "$SCORE"; \
	echo Score update, "$SCORE" | festival --tts; \
fi; \
sleep 60; done

Reads out score updates by checking the BBC scorecard every minute. You need Festival installed, for the text to speech conversion.