xkcd - reminder

This is the only page in english on my website so far, but I think this is necessary since the xkcd comic has many fans from all over the world, who may be intresseted in this.

xkcd -reminder is a tiny bash script which can be setup with nearly every linux autostart mechanism.
It reminds you automatically if an new comic is avaiable by downlaoding and showing it.
You need image magick and zenity to use it.
You'll also have to create a folder called image in the same directory as the script.

#xkcd - reminder by sebastian schumb 2008

# Check wether it's a publishing day
day="$(date +%w)";
if [ "$day" -eq '1' -o "$day" -eq '3' -o "$day" -eq '5' ]; then

# remove the old gabage
rm rss.xml
rm ./image/*.*

# load the rss feed
wget http://xkcd.com/rss.xml -o /dev/null;

# get title alternativ imageurl from the feed using expr 
feed="$(cat ./rss.xml)";

title="$(expr "$feed" : '.*.*')";

description="$(expr "$feed" : '.*[^<]*<\([^<]*\)/>.*')";
alt="$(expr "$description" : '.*alt="\([^"]*\)"')";
imageurl="$(expr "$description" : '.*src="\([^"]*\)".*')";

# download the image 
cd ./image;
wget "$imageurl" -o /dev/null

# get only the filename
image="$(expr "$imageurl" : '.*/\(.*\)')";

# use image magick to display the file
display "$image" &

# use zenity to display the title an alternative Text
zenity --info  --title="$title :: XkcdReminder" --text="$alt"

killall display;

Please feel free to copy and modify this script under the conditions of the Gnu Public License (GPL).

First published : 23.5.2008 14:24:17 Last edit : 23.5.2008 14:24:17 Viewed by 8463 visitors.