How I record watching movies

When I rate a new movie, I need to populate my local database with the relevant information. This needs to include the synopsis but also related values such as the genres, director and writers. I pull data from IMDB, but they don't have an official API I can access easily.

I use a package called IMDb PHP which uses screen scraping to build up an API interface to find movie information. I have wrapped this in a service which makes the relevant calls, such as for directors, writers and genres, and processes the data into my local database.

When I create a new “Watched” instance, I use a model observer that checks the IMDB ID against my local database. If it doesn't exist, then it uses the package to pull the data from IMDB. The title, year released, runtime and synopsis are all copied to my local database and it builds relationships with genres, languages, directors and writers.

Watched::create([
	'ImdbId' => 'tt1488589',
	'Rating' => 9,
	'Watched' => '2023-01-22',
	'Viewing' => 'netflix',
]);

The observer also uses TMDB API to store a reference to the movie on The Movie DB. This shows a link to the movie page. I use a PHP wrapper which makes this easy. Sometimes I manually add posters from this service, which is done via a CMS.

The movie social network Letterboxd has an API, but you have to request access. Unfortunately, after a few attempts, I haven’t even had a response from them. This means I can’t automatically link my movies to the website, which is unfortunate.

I have a few ways I can trigger this process;

  • Command Line
  • Nova
  • iOS Shortcut

Command Line

When I started recording my movies, this website was built using the Fuel PHP framework. This provided a command line utility (oil), which was the easiest way for me to record my movies. I have since migrated to using Laravel, which also provides an easy command line utility called artisan. You can write commands which take arguments and the processing is all in PHP.

I start the command with php artisan movie:watch and it prompts me with questions I need to answer to successfully add the movie. Each question has basic validation, such as the date must not be the future and the rating must be between 1 and 10.

Nova CMS

I use Laravel’s first-party content management called Nova. Now instead of using the command line, I can log into a nice user interface. I have created an action I can call with a click of a button. The same options are present and submitting this form adds the movie.

A Basic Shortcut

One of the pain points I have when adding movies from my mobile device was finding out the IMDB ID. I use the official IMDB iOS app, so copying this value – which is usually found in the URL – was difficult.

I was able to write a really basic iOS Shortcut action that is added to the iOS share sheet. This uses the shared URL IMDB provides, finds the tt-prefixed string, adds it to my clipboard and then opens the Nova page.

The downside is that I still have to click the “Add Movie” and paste the copied string in the IMDB field and fill out all the other fields. It’s a little clunky but works fine the majority of the time.

Shortcut Improvements

Shortcuts on iOS are a lot more powerful now, so I am investigating implementing a more streamlined way of recording a movie. The start of the process would the same, but I would then need to be prompted by the date, rating, and type options. This would then make a JSON API call to my website. I have started writing the API to handle this but would need to learn how to build the shortcut. A task that should be relatively straightforward, but appears really confusing at first.