Originally this was going to be purely a physical clock. Inspired by a friend, I was motivated to make virtual versions. Unfortunately I know very little of making websites and automatic tweeting. Thankfully there is a wealth of tutorials out there. As in the previous posts I made Python do the heavy lifting.
First up I looked at the well known website making and hosting services. Amongst the many beautiful templates, there was very little to allow for something as singular as a ticking, textual clock. So I decided to build a webbapp from the ground up, containing a ticking clock on each page. I made use of Flask, a python microframework. Of the many tutorials on Flask, I found Your First Flask Website on PythonHow by far and away the most useful. I pretty much followed every page right up to deploying it to Heroku.
Having got the clock up and ticking with the quote, book title and author, it would be wonderful to link the book to somewhere with further information. Do this manually for all the books was beyond me. When looking for a way to automate this, I wanted one method to cover the huge range of books, from bestsellers to niche 19th century literature. This led me to Amazon, and using the affiliate program Python API I could link every book to further information on their Amazon page. You can find the code snippet I used to do this in
The next stage was to share the quotes, a minute of the morning with a minute of the afternoon, day by day. Once again there is a very useful Python library - Tweepy, which does a wonderful job of sending tweets. The trick is to submit the tweets at exactly the right time. On my Raspberry Pi, I used the cron scheduled daemon to send the tweet, to the minute, the quote refers to. You can find the code I used to do that in
Finally, to make these posts, I took what I needed from this tutorial. This meant that I just had to write up, what I am writing now, in Markdown. Then this is automatically translated into html and once again by your browser into this. By far and away the easiest way I found to add posts to the website.
What next? Well so far I have only hinted at the types of books (admittedly varied) that have provided quotes, perhaps a post discussing them is in order?