Day One Script for Ubuntu

Screenshot from 2017-10-06 00-32-25.png

Since I have been developing a lot more lately, I haven't been on my iPad as much. So when I pulled up Day One today, I was kinda sad to see that my last entry was over a month ago.

I know Day One has a macOS app but my preferred development enviornment is Ubuntu running on a Lenovo Thinkpad. Since I took the day off from working on Bob today, I decided to write a short python script to write journal entries directly from my Ubuntu terminal.

It was actually pretty easy, I just created a recipe in IFTTT to send a Webhook request and turn the information that I pass to it into a journal entry. The whole thing took probably forty five minutes. I still have to add things like image support but that will be another night.

I'm just happy I can quickly add text entries at the moment! 

#!/usr/bin/python

import requests

print "Entry title:"
title=raw_input()

print "Content:"

contents = []

while True:

    try:
        line = raw_input("")

    except EOFError:
        break

    contents.append(line)

text = '\n'.join(contents)

print "Entry: \n\nTitle: "+title+"\n\nContent: "+text+"\n\nSave entry? "

text = text.replace('\n', '<br /><br />')

save=raw_input()

if (save == "Y" or save == "y"):
    r = requests.post("https://maker.ifttt.com/trigger/journal_entry/with/key/xxxxx", data={'value1': title, 'value2': text})