View Single Post
Old 01-15-2014, 04:56 AM   #6
pacraf
Junior Member
pacraf began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jan 2014
Device: K3 keyboard
Again did FactoryReset.
This time not started woth JB installation , but first connected to WiFi , registered in amazon account, then after some minutes to give the device to sync with account - started to install JB , keys, KUAL.

And hallelujah! - no bad email, already one hour installed and works.

Now I started to think on Weather Script addon to KUAL.

My linux knowledge is more than poor, but like saind on begining - server side works nice.

I would like to have this Weather screen to be isntalled in a way that can be easy switched off (no need of device restart).

I tried to take example addon (choice was on battery reporter).

what was changed:
config.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<extension>
    <information>
        <name>Helper</name>
        <version>1.0</version>
        <author>Twobob</author>
        <id>Weather</id>
    </information>
    <menus>
        <menu type="json" dynamic="true">menu.json</menu>
    </menus>
</extension>
file menu.json

Code:
{
    "items": [
        {
        "name": "Helper",
        "priority": 0,
        "items": [
            {"name": "Weather", "priority": 1, "action": "bin/weather.sh"}
        ]
        }
    ]
}

and file weather.sh in folder /bin
(intentionally left server addres of script author, because this one is available on internet - my only on intranet - so this one is better to discuss here...)
Code:
#!/bin/sh
killall -STOP cvm;
killall -STOP powerd;
cd "$(dirname "$0")"
rm .weather-script-output.png
eips -c
if wget http://docs.volcanis.me/weather-script-output.png -O .weather-script-output.png; then
	eips -g .weather-script-output.png
else
	eips -g .weather-image-error.png
fi;
waitforkey;
killall -CONT cvm;
killall -CONT powerd;
# Go Home
echo "send 101" > /proc/keypad
above works. I mean works once is run - then never updates, of course becasue
this script is intended to be started by cron. (because started from KUAL once is displaying weather picture, but no update loop)

I saw another solution on this forum (I only replaced server address to this one available on internet):

weather.sh


Code:
#!/bin/sh

if [ `lipc-get-prop com.lab126.wifid cmState` != "CONNECTED" ]; then
	exit 0
fi

stop pillow
sleep 1

URL=http://docs.volcanis.me/weather-script-output.png
FILE=${URL##*/}

fetch () {
	while :
	do
		sleep 60
		if wget $URL 1>/dev/null 2>/dev/null; then
			eips -g $FILE
			rm $FILE
		fi;
	done
}

cd /var/tmp

if wget $URL 1>/dev/null 2>/dev/null; then
	eips -g $FILE
	sleep 1
	eips -g $FILE # just in case Kindle Launcher is repainted
	rm $FILE

	fetch &
	pid=$!
	waitforkey;
	kill -9 $pid
else
	eips -g /mnt/us/extensions/apiweather/weather-image-error.png
fi;

start pillow
Unfortunatelly this script does nothing on my kindle. (leaving from KUAL to main Home screen)

Any suggestion...

Author of this script added connection checker - no doubts I am connected...

Last edited by pacraf; 01-16-2014 at 02:45 AM.
pacraf is offline   Reply With Quote