Skip to content

Instantly share code, notes, and snippets.

@sirpoot
Created September 10, 2013 13:56
# time to wake up
lipc-set-prop com.lab126.powerd wakeUp 1
sleep 3
mntroot rw
# download new images
lipc-set-prop com.lab126.cmd wirelessEnable 1
sleep 20
url=http://yourOwnURLhere.com
rm index
wget $url/images/index || error_exit "Cannot download list of images!"
grep "/img/uploads" index | awk -F\" '{print $2}' > /mnt/us/images.txt
cd pics
while read line
do
wget $url$line
done < /mnt/us/images.txt
# mark all images as downloaded
wget $url/images/reset
rm reset
lipc-set-prop com.lab126.cmd wirelessEnable 0
# randomize current set of photos
for f in /mnt/us/photos/*
do
newfile=`mktemp -p /mnt/us/photos`
mv -f $f $newfile
done
# if pics are downloaded, then choose between a pic and a photo
if [ "$(ls -A /mnt/us/pics)" ]
then
# 50% probability of displaying pic or photo
if [ `sed 's/[^[:digit:]]\+//g' < /dev/urandom | head -n 1 | awk '{print substr($0,0,2);}'` -lt 50 ]
then
# display a downloaded pic
echo displaying a downloaded pic
mv -f "/mnt/us/pics/`ls /mnt/us/pics -1 | head -n 1`" /mnt/us/linkss/screensavers/bg_xsmall_ss00.png
else
# display a photo
echo displaying a photo
cp "/mnt/us/photos/`ls /mnt/us/photos | sort | head -n 1`" /mnt/us/linkss/screensavers/bg_xsmall_ss00.png
fi
else
# no pics currently, just change to a photo
cp "/mnt/us/photos/`ls /mnt/us/photos | sort | head -n 1`" /mnt/us/linkss/screensavers/bg_xsmall_ss00.png
fi
/usr/bin/powerd_test -p
a=0
while [ $a -lt 50 ]
do
lipc-set-prop com.lab126.powerd deferSuspend 86400
sleep 2
a=`expr $a + 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment