![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 74
Karma: 889004
Join Date: Mar 2014
Device: Kindle PW2
|
Weather screensaver background script
As I've put in some work in updating the weather screensaver, I thought I'd share it here. You obviously need the server-side script to create the weather image. Just replace the display-weather.sh script from the original package on the Kindle.
Features: * customizable interval * turns WiFi on/off * refreshes screen Missing features: * wake device up when in suspend Thanks to NiLuJe for the tip about eips. Code:
#!/bin/sh # how old (in minutes) the screensaver image should be at the least to # fetch it again from the server INTERVAL=100 # whether to disable WiFi after the script has finished (if WiFi was off # when the script started, it will always turn it off) DISABLE_WIFI=0 # domain to ping to test network connectivity TEST_DOMAIN="www.google.com" # URI of screensaver image IMAGE_URI="http://www.example.com/weather.png" # if update failed, the script would try to download the image again # when it is executed next (depending on the cron job). If you do not # want this to happen, set DONOTRETRY to 1 and the next update attempt # will only happen after $INTERVAL minutes DONOTRETRY=0 # directories SCREENSAVERFOLDER=/mnt/us/linkss/screensavers/ SCREENSAVERFILE=/mnt/us/linkss/screensavers/bg_medium_ss00.png # check whether we need to update if [ -e $SCREENSAVERFILE ]; then if test `find $SCREENSAVERFILE -mmin +$INTERVAL`; then echo "Screensaver is older than $INTERVAL minutes, going to update." else echo "Not updating, screensaver is recent enough." exit fi else echo "Screensaver not found, updating" fi # change to directory of this script cd "$(dirname "$0")" rm -f .weather-script-output.png # enable wireless if it is currently off if test 0 -eq `lipc-get-prop com.lab126.cmd wirelessEnable`; then echo "WiFi is off, turning it on now" lipc-set-prop com.lab126.cmd wirelessEnable 1 DISABLE_WIFI=1 fi # wait for network to be up TIMER=15 CONNECTED=0 while test 0 -eq $CONNECTED; do # test whether we can ping outside /bin/ping -c 1 -w 2 $TEST_DOMAIN > /dev/null && CONNECTED=1 # if we can't, checkout timeout or sleep for 1s if test 0 -eq $CONNECTED; then TIMER=$(($TIMER-1)) if test 0 -eq $TIMER; then echo "No connection after timeout, aborting." break else sleep 1 fi fi done if test 1 -eq $CONNECTED; then if wget -q $IMAGE_URI -O .weather-script-output.png; then mntroot rw cp .weather-script-output.png $SCREENSAVERFILE mntroot ro echo "Screen saver image updated" # refresh screen lipc-get-prop com.lab126.powerd status | grep "Screen Saver" && ( echo "Updating image on screen" eips -f -g $SCREENSAVERFILE ) else echo "Error updating screensaver" if test 1 -eq $DONOTRETRY; then touch $SCREENSAVERFILE fi fi fi # disable wireless if necessary if test 1 -eq $DISABLE_WIFI; then echo "Disabling WiFi" lipc-set-prop com.lab126.cmd wirelessEnable 0 fi Last edited by peterson; 03-15-2014 at 11:15 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to prevent apps from going in background on screensaver/USB? | Aeris | Kindle Developer's Corner | 0 | 10-23-2013 06:24 AM |
Altering HTML Script To Properly Display Background Images In ADE Ereaders. | Turk.Turkleton | Sigil | 16 | 09-25-2012 12:34 PM |
Linux script for images to Kindle Screensaver | soymicmic | Kindle Developer's Corner | 4 | 01-28-2011 11:20 AM |
Pdf background darker than LRF/RTF background | LOL2005 | Sony Reader | 2 | 10-23-2007 11:00 AM |