pascalw / kindle-dash

Power efficient dashboard for Kindle 4 NT devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fetch_dashboard.sh to check ETag?

julianlam opened this issue · comments

Related to #2, someone on HN mentioned that you may be able to increase battery life by checking the ETag and not running eips if the tag has not changed.

Hey @julianlam yes, thanks for the suggestion. I think eips might already be doing something like this under the covers, but I'll look into this in more detail soon.

I briefly looked into this and indeed it seems that eips is doing something like this already internally. Calling eips twice with the same image results in only one screen update (the first call), even with the -f (full screen update) flag.

Doing a conditional HTTP request might save a tiny bit of energy, as the Kindle doesn't have to download the data and write to disk if the image hasn't changed. Given that these dashboard images are pretty small (mine are about 40kb), I doubt it's worth it to pour much time into this.

I'll soon merge a small change though that will make it easier to process headers of HTTP responses. With that it should be possible to implement conditional GET requests in fetch_dashboard.sh, so outside of the 'core' code. I'll add an example for this after I merge these changes.

Thank you for looking into this. It's good to know eips is smart enough to not do the full screen update if the image has not changed.

Unrelated, but I noticed eips screws up if the image is not grayscale. At least, with my test 600x800px RGBA PNG image. I wonder if eips knows how to automatically convert to grayscale...

Indeed this is something to add to the documentation (which is a bit lacking as you might've noticed 😅). You can use pngcrush -c0 image.png (on the server) to convert the image to grayscale. It's also easy to with pngjs if you produce the images with Node.js.

Thanks for the tips, I was hoping I wouldn't have to use imagemagick 👍

Just wondering, what utility did you use to convert the dashbling dashboard to an image? I ended up with firefox --screenshot since both CutyCapt and phantomjs came with a ton of dependencies (per apt, anyway)

I'm using Puppeteer + headless Chrome. I'm not behind my computer right now, I'll post the code later (and include it in the docs).

@julianlam I've added a bit of docs + the code I use here.