View Single Post
woody14619's Avatar
Posts: 1,455 | Thanked: 3,309 times | Joined on Dec 2009 @ Rochester, NY
#86
Ok.. So I was wondering why this was taking so long to make the screen, and after looking at the code run a few times, I found it was mainly the file interaction of saving several temporary files to merge.

The thing is, ImageMagick doesn't need to do that, it can merge all the images together in one shot as layers. In fact, it can rescale, overlay and draw text right on the temporary in-memory image. I changed the script to make all the conversions happen in one convert command, and the speed and CPU use is hugely affected. It's much faster now and uses less CPU.

I also changed the return codes to better show what's happening in QBW. If it works, it's green (0), if it doesn't update because it's offline it's light red (2), it if dosn't update because it's not on wifi it's yellow (1), and for other failures it's dark red (-#). This makes it work much nicer with a desktop widget that can auto-run it at regular intervals.

Attached is the new script. Enjoy!
Attached Files
File Type: gz weather.tar.gz (1.6 KB, 101 views)
 

The Following 4 Users Say Thank You to woody14619 For This Useful Post: