The Movie Diary with Airtable and Pythonista

I have an itch to tweak my workflows until they're perfect only to break them apart and start all over again, and with the Movie Diary, my favorite and most used action, I was unsatisfied with Day One as a log keeper for habitual stuff, because every log template organizes data that would fit better in a database and that's not what makes a great journaling app, which Day One is.

After the release of Day One 2.0 I started looking for alternatives, Momento, another journaling app, couldn't format MultiMarkdown tables nor accept the poster from an URL scheme call, making it a step backwards. Evernote would also lack the benefits from using a database (I'm also glad not to use it anymore). Microsoft Excel or Numbers would give me database-like sorting and filtering, I just wouldn't be able to insert data from iOS. Then in Viticci's 'New Apps for 2016' roundup I was introduced to Airtable, a mix of spreadsheet and visual database that would be the perfect place for the kind of data we want to log in the Movie Diary.

Configuring Airtable

Airtable is a webservice with a native app available for iOS, it allows you to sort, filter and connect entries in the database with a layout that adapts to whatever device you're on. The first step is to create a new database, these are the required steps on the iOS app:

  1. Tap the New base button;
  2. Select Create a new empty base;
  3. Name your database;
  4. Tap the big circular plus button in the bottom-center;
  5. In the card view, you'll get the default fields (Name, Notes and Attachments). Tap Customize... in the bottom-left corner;
  6. Rename Name to Title;
  7. Rename Notes to Overview;
  8. Rename Attachments to Poster;
  9. Add a new Single Line Text field named Rating;
  10. Add a new Single Line Text field named Directors;
  11. Add a new Single Line Text field named Year;
  12. Add a new Date field named Date;

You should reorder the fields to provide most important information at glance, for example, I use Title followed by Rating, so when I'm visualizing the entries on the iPhone I can see these fields and the poster. You can also rename the table, The name of your database and the name of your table is not relevant to configure this workflow, so you can customize those as you like.

Now we gotta setup your API and, unfortunately, the experience is not consistent across mobile platforms and you'll face difficulties setting up the API on a mobile device, for example, attempting to login on a mobile device will open the app in the App Store. You can fake a desktop browser on iOS with iCab Mobile:

  1. Tap the cog wheel icon to open the "Settings" panel;
  2. Tap "Web Sites";
  3. Tap "Browser ID";
  4. Change "Default Browser ID" to the latest Mac version (Safari 7.1 (Mac)).

Whenever you're ready to configure the API, log in from the API page (available at the footer), log into your account, choose your newly created database and you'll go to a full documentation page customized to your database, I want you to look at the URL, it should look like<random string>/api/docs#curl/introduction and I want you to save that <random string> bit for later (use Drafts, Clips or Copied). Here you'll realize that you could set whatever name pleased you for the fields, but for the sake of simplicity, you should stick with mine for now.

Still in the documentation in your desktop environment, tap the Open Base link in the top-right corner (or just open your Dashboard any other way). Look up the name of the table in the bottom-left corner, it should be Table 1, but you can change it, if you do, don't forget to setup in the script accordingly. Click the people icon in the top-right corner and select Account in the dropdown, near the bottom you'll find a Generate API key link, tap it, copy the string it provides and save it for later.

Configuring Pythonista

Are you still here? The worst part is over and you're welcome to enter Valhalla with your API and database keys. You're welcome to run the script, if you got the New from Gist script a while ago, this will be a smooth installation.

Movie Diary

The new movie diary using Airtable and Pythonista to journal the movies you watch.

View Script

The first time you run the script you'll be prompted 4 times for configuration. The first prompt is for the MovieDB API key and is comes pre-filled with my token, which you were already using in the previous version; you can set your own MovieDB API key or just continue the script. After finding and selecting a movie you'll be asked to insert your Airtable API key (the one that starts with key), then the database ID and finally the name of the table, prefilled with Table 1 unless you renamed it earlier. Pick a rating and you'll receive a HUD alert indicating if the entry was successfully added. You'll never be asked for these credentials on this device again.

Whatever you log, I think Airtable is a formidable tool with a good API to explore and Pythonista 2.0 with its action extension made me return to Python as a way to solve problems on iOS. Now go watch some movies and get used to these apps as we’re going to see this combo again soon.


Can I import my entries from Day One?
Not possible, sorry, you gotta do it manually. Here's something to help you: Uncomment line 76 and comment line 77, now you'll get a datepicker dialog while adding movies. We could perhaps build a tool for OSX if we get enough interest, but it took me around 1 hour to manually add all my entries, and I have a lot of them. This is a good reason to move to Airtable since it exports databases in CSV format.
I misconfigured, how do I reset the keys and tokens?
You can run this script to overwrite the configuration, it will prefill each field with the current stored value so you can only update the field you want, if you renamed the table or something.
Why am I getting an Failed to Connect error?
First check if you're not offline, then update to the latest version of the script. If all fails, send me an email or a DM on Twitter so we can work this out, still covering every possible error in this scenario and the message is pretty much boilerplate only.
Why am I getting an Invalid Data error?
Most of the time this happens due to date formatting. The script is configured by default to include only the date to your entries, not the time. If you're unsure, open your database, then an entry and go to Customize Fields, edit the Date field and look for the Include a time field toggle, turn it off if you don't need the time. If you want to have the time in the database, remove .date() from line 77 and replace date_dialog() in line 76 for datetime_dialog().
How can I add the time to the date of my entries?
Check the previous answer.
My problem is not listed here.
E-mail or tweet my way.