.gitignore | ||
first_verse.png | ||
generate_image.py | ||
kindle_photo.jpg | ||
kindle_photo.png | ||
README.md | ||
Tao Te Ching.pdf | ||
Tao Te Ching.txt |
Automated Infodumping
I really enjoy the fact that Tao Te Ching by Lao Tzu exists. The first translation I have ever read was Carol Deppe's. It's simple, made with some artistic liberty to read more easily, so it was a great intro.
I wanted to infodump about it to snow but that's a lot of content to speak or type, even for me. But she did some computer magic to a kindle and exposed http://kindle.sn0w.cx/data
which accepts image data in POST
requests and displays them on that kindle (somewhere in her house).
Then I found out about this beautiful font Compass by somepx.
And now I connected those two dots into the inspiration for this quick project.
The code
This is very spaghetti code - don't use it as a good example of programatic image generation. I was writing it as I was experimenting and silly reasons don't justify refactoring time. It works!
The code runs every day but it only generates and sends an image every 3 days. It takes the next quote that it hasn't shown yet, finds the right font size and line breaks in a very inefficient way, adds the attribution for the translator of the book and the font author, and POST
s it to snow's kindle.
Result
Now all my infodumping about Tao Te Ching will happen automatically! It will happen over *quick math* about a year (107 quotes, once every 3 days).
I love the old-school fantasy look of the text and I find it satisfying that it displays literal ancient wisdom.
Attribution
Font
Compass by somepx. I bought it, so I can't include it here. You can buy it and copy the file to the directory where you run the code or you can use any other font and it should work (maybe with some tweaks).
Tao Te Ching
You can download the pdf of the book from the author's website https://www.caroldeppe.com/. The PDF also mentions it's okay to share the PDF so I included it as well as the txt
version of the "Master/she" section for the Python code.