tmdb-obsidian is a script for QuickAdd that allows you to add links for watching movies to your Obsidian Vault notes.
By typing the movie's name, it returns the movie details from The Movie Database (TMDb) API and a link to watch the movie on Movie-Web.
This script is a modified version of movies.js by chhoumann.
I use this script to mantain a simple note with my watchlist. While, there are other amazing approaches that you can try to create a personal movie database, where each movie is a note, I prefer not to replicate what's already available on websites as TMDb, IMDB, etc. That's the magic of Obsidian ―you can have it your way.
demo.webm
The first step is to copy the script that will help us fetch movie information and create a note to store our movies:
- Download the tmdb.js and copy it into your vault (e.g. create a
/scripts
folder and paste it there). - Create a new note in your Vault to store the movies (e.g:
Movies to watch
,Watchlist
)
Now, we need to set up a series of actions—searching for the movie, pulling its information, and pasting the details into our watchlist. For this, we can leverage on the Macros feature of QuickAdd. Let's create one:
- Open the QuickAdd plugin settings (Click on the settings icon or
Ctrl
+,
and then scroll to QuickAdd under Communnity Plugins on the left). - Click on
Manage Macros
button. - In the Macro Manager window choose a name for you macro (e.g.
movies
) and clickAdd Macro
. - To setup the Macro click on
configure
. - In the
User Scripts
option choose thetmdb
script and clickadd
. - Click on the settings icon
⚙️
to the right of thetmdb
script and paste theAPI Key
provided by TMDb (If you don't have one, refer to the requirements section above).
-
Click the
Capture
button to add aCapture
choice and then click the settings icon⚙️
besides the newUntitled Capture Choice
. -
Double click the title to rename the choice and add a name (e.g.
add movie
). -
Under
File Name
choose the note you created before to store the movies (e.g.Movies to watch.md
). -
Toggle on the
Write to bottom of file
option. -
Toggle on the
Capture format
option. -
Copy and paste this format:
- [{{VALUE:original_title}}]({{VALUE:movieLink}}) ({{VALUE:releaseYear}}) - {{VALUE:directorNames}} - {{VALUE:genre}} - {{VALUE:rating}}
This will generate
- [Forrest Gump](https://movie-web.app/media/tmdb-movie-13) (1994) - Robert Zemeckis - Comedy - 8.5
To create your own query, check all the variables available.
Now we need to create a choice to activate the macro:
- Go back to the
QuickAdd Settings
menu. - Add a name for the macro (e.g:
Movie
), selectMacro
in the dropdown and clickAdd choice
. - Click on the settings icon
⚙️
besides the new macro and select the macro we created beforemovies
(or the name you choosed). And That's it! Close all the menus and let's add some movies.
- Open the
command palette
(Ctrl
+p
). - Type QuickAdd and select
QuickAdd: Run QuickAdd
and pressEnter
. - Select
Movie
and pressEnter
. - Type the name of a movie
Forrest Gump
and pressEnter
. - Select the movie that you want to add, and thats it!
You can access any of the TMDb variables by using {{VALUE:<variable>}}
tag (e.g. {{VALUE:original_title}}
). For more information check the TMDb API documentation
Here's an example for the movie Forrest Gump:
{
"adult": false,
"backdrop_path": "/qdIMHd4sEfJSckfVJfKQvisL02a.jpg",
"belongs_to_collection": null,
"budget": 55000000,
"credits": {
"cast": [...], // Array of cast details
"crew": [...] // Array of crew details
},
"genres": [
{ "id": 35, "name": "Comedy" },
{ "id": 18, "name": "Drama" },
{ "id": 10749, "name": "Romance" }
],
"homepage": "https://www.paramountmovies.com/movies/forrest-gump",
"id": 13,
"imdb_id": "tt0109830",
"original_language": "en",
"original_title": "Forrest Gump",
"overview": "A man with a low IQ has accomplished great things in his life...",
"popularity": 101.714,
"poster_path": "/arw2vcBveWOVZr6pxd9XTd1TdQa.jpg",
"production_companies": [...], // Array of production company details
"production_countries": [
{ "iso_3166_1": "US", "name": "United States of America" }
],
"release_date": "1994-06-23",
"revenue": 677387716,
"runtime": 142,
"spoken_languages": [
{ "english_name": "English", "iso_639_1": "en", "name": "English" }
],
"status": "Released",
"tagline": "The world will never be the same once you've seen it through the eyes of Forrest Gump.",
"title": "Forrest Gump",
"video": false,
"vote_average": 8.476,
"vote_count": 25771
}
Also, you can use any of this custom variables:
{
"actorLinks": [
"[[Tom Hanks]]",
"[[Robin Wright]]",
"[[Gary Sinise]]",
"[[Sally Field]]",
"[[Mykelti Williamson]]",
// ... (rest of the actor links)
"[[Bob Hope]]"
],
"actorTopFiveLinks": [
"[[Tom Hanks]]",
"[[Robin Wright]]",
"[[Gary Sinise]]",
"[[Sally Field]]",
"[[Mykelti Williamson]]"
],
"directorLinks": [
"[[Robert Zemeckis]]"
],
"directorNames": "Robert Zemeckis",
"releaseYear": 1994,
"genre": "Comedy",
"genres": [
"[[Comedy]]",
"[[Drama]]",
"[[Romance]]"
],
"movieLink": "https://movie-web.app/media/tmdb-movie-13",
"fileName": "Forrest Gump",
"typeLink": "[[Movies]]",
"poster": "https://image.tmdb.org/t/p/w500/arw2vcBveWOVZr6pxd9XTd1TdQa.jpg",
"rating": "8.6"
}