A couple of weeks ago, I ran across Matthew Petroff’s Kindle Weather Display but I don’t own a Kindle; I have a Nook, and because I mostly just read locally-stored documents on it, I haven’t bothered to root it. Even with those changes, I managed to find a way to adapt the original script to my environment.
I run Linux as my daily OS, so I skipped some of Matthew Petroff’s instructions for setting up a server to pull down the weather data and crunch it into a PNG file. I already had Apache installed on my laptop with the DocumentRoot pointed to /var/www. I installed pngcrush but found the version available in the repository was a couple of versions old and didn’t support the original script’s -ow argument that tells pngcrush to overwrite the file. The simple solution is to change the script to write one file with rsvg-convert and write a different file with pngcrush. These PNG files are so small (40-50Kbytes) that it’s no problem leaving an extra one lying around. At this point, I had the script working and depositing a weather graphic where I could view it locally with a web browser. The last piece was getting the graphic onto the Nook.
Since the Nook was unmodified, I couldn’t use Matthew Petroff’s method of running a script on the eReader that collects and displays the image, but an un-rooted Nook does let you set up your own screensaver images. When the Nook is plugged into my laptop, to charge or to let me add or remove files, it automounts at /media/nook. The final step was to add some code to the original script to see if the Nook is mounted, and if so, copy the fresh image to the custom screensavers directory.
With this script running once an hour, all I have to do is plug the Nook into my laptop and wait for cron to update the screensaver image with the latest forecast. While the Nook is mounted, it displays an image telling the user it’s plugged in and mounted, but once it’s detached, it will display the forecast as its “idle” image when I’m not reading books on it. If I find an inexpensive Nook or Kindle, I may stick it on the wall and fully implement the original scheme (with a Raspberry Pi gathering and formatting the forecast), but until then, I have my customisable forecast on the Nook I already have.
Here’s my cron job, based on the original, modified as described in this post:
#!/bin/sh cd "$(dirname "$0")" python weather-script.py rsvg-convert --background-color=white -o weather-script-raw.png weather-script-output.svg pngcrush -c 0 -q weather-script-raw.png weather-script-output.png cp -f weather-script-output.png /var/www/weather-script-output.png if [ -w /media/nook/my\ screensavers/wx/wx.png ]; then cp -f weather-script-output.png /media/nook/my\ screensavers/wx/wx.png fi