Kindle/Weather Display: Difference between revisions

From Wiki
No edit summary
Line 62: Line 62:
== Server ==
== Server ==
* apt-get install pngcrush librsvg2-bin
* apt-get install pngcrush librsvg2-bin
* /etc/cron.d/kindle-weather
<blockquote>
<pre>
# m h dom mon dow user command
*/30 * * * * root /usr/bin/python2 /srv/kindle-weather/weather-script.py
</pre>
</blockquote>
* /srv/kindle-weather/weather-script.py
<blockquote>
<pre>
#!/bin/sh
initctl stop framework &
sleep 3
initctl stop powerd &
sleep 5
/mnt/us/scripts/weather-display.sh >/dev/nul &
</pre>
</blockquote>

Revision as of 09:24, 19 April 2013

Based on http://www.mpetroff.net/archives/2012/09/14/kindle-weather-display/

modified for Kindle Touch 5.1.2

Kindle

  • /mnt/us/scripts/weather-init.sh
#!/bin/sh
initctl stop framework &
sleep 3
initctl stop powerd &
sleep 5

/mnt/us/scripts/weather-display.sh >/dev/nul &


  • /mnt/us/scripts/weather-display.sh
#!/bin/sh
#
# This script will reload the display only is source png file changed
# log data is going to /tmp/weather-display

while  :
do
	rm weather-image.png
	if wget -q http://host/weather/kindle/weather-image.png
	then
		if [ ! -e weather-current.png ]
		then 
			cp weather-image.png  weather-current.png
		fi

		if [ "$(cat weather-image.png | md5sum)" != "$(cat weather-current.png | md5sum)" ]
		then
			echo $(date -Iseconds) "|" new file >> /tmp/weather-display
			rm weather-current.png
			cp weather-image.png weather-current.png
			eips -c
			eips -c
			eips -f -g weather-current.png
		else
			echo $(date -Iseconds) "|" no changes >> /tmp/weather-display
			#eips -g weather-current.png
		fi
	else
		echo $(date -Iseconds) "|" error >> /tmp/weather-display
		eips -g weather-image-error.png
	fi

	#echo $(date -Iseconds) "|" screen written >> /tmp/weather-display
	sleep 300
done

Server

  • apt-get install pngcrush librsvg2-bin
  • /etc/cron.d/kindle-weather
# m	h	dom	mon	dow	user	command
*/30	*	*	*	*	root	/usr/bin/python2 /srv/kindle-weather/weather-script.py
  • /srv/kindle-weather/weather-script.py
#!/bin/sh
initctl stop framework &
sleep 3
initctl stop powerd &
sleep 5

/mnt/us/scripts/weather-display.sh >/dev/nul &