Blipfoto.sh

From ST2205u wiki
Jump to: navigation, search

This is a small Bash-script to display the latest entry-thumbnail posted on Blipfoto.com.

#!/bin/bash
LD_LIBRARY_PATH=./libst2205
BASEURL="www.blipfoto.com"
DEV=/dev/sdb
SETPIC=./setpic/setpic
OLDURL=""
while true; do
wget $BASEURL 2>/dev/zero
URL=`grep color index.html |grep jpeg|xargs -n1|grep color|cut -d"'" -f6|xargs -n1 echo $BASEURL/|sed s/\ thu/thu/|head -n1`
if [ "$OLDURL" != "$URL" ]
then
wget $URL -O - 2>/dev/zero >pict.jpg
convert pict.jpg pict.png
$SETPIC $DEV pict.png >/dev/zero
OLDURL=$URL
fi
rm index.html
sleep 60
done

Start it from within the st2205tool-dir, or modify the parameters in the beginning. --TD-er 01:19, 22 January 2008 (CET)


Modified for Flickr

#!/bin/bash
LD_LIBRARY_PATH=./libst2205
BASEURL="flickr.com/photos/"
DEV=/dev/sda
SETPIC=./setpic/setpic
OLDURL=""
while true; do
wget $BASEURL -O index.html 2>/dev/zero
URL=`grep 'span class="photo_container pc_t">' index.html |grep jpg|xargs -n1|grep static|cut -d"'" -f6|xargs -n1 echo $BASEURL/|sed s/\ thu/thu/|head -n1|tail -c64|sed s/_t.jpg/_m.jpg/`
if [ "$OLDURL" != "$URL" ]
then
wget $URL -O - 2>/dev/zero >pict.jpg
convert -gravity Center -resize x128 -resize '128x<' -crop 128x128+0+0 +repage pict.jpg pict.png
$SETPIC $DEV pict.png >/dev/zero
OLDURL=$URL
fi
rm index.html
sleep 5
done
Personal tools