Skip to content

obsidian.md plugin to grab data from public movie Databases and make them into a note that can be used with dataview querries

License

Notifications You must be signed in to change notification settings

Superschnizel/Obsidian-Moviegrabber

Repository files navigation

Obsidian Moviegrabber

A plugin to generate notes for movies and series with properties that can be used with dataview. Uses the Open Movie Database (OMDb) API to retrieve movie/series data and the Youtube Data API to get the embed links for the trailers (optional).


Usage

showcase.mp4

(Disclaimer: the choice selection uses outside assets for the movie posters in the preview, retrieved in the search request to OMDb)

To use this plugin you need to create an API key for the OMDb here and optionally also a Youtube Data API Key as described here. and set these in the plugin settings.

To search for a movie or series, simply call the command Search movie or Search series and search a movie by entering a title or a valid IMDB-id.

Templates

To define how the data will be saved in your notes you can define a template. This template uses tags of the form {{tag}} to fill in the data. The available tags are:

{{Title}}
{{Year}}
{{Rated}}
{{Runtime}}
{{Genre}}
{{Director}}
{{Writer}}
{{Actors}}
{{Plot}}
{{Language}}
{{Country}}
{{Awards}}
{{Poster}}
{{PosterLocal}}
{{Ratings}}
{{Metascore}}
{{imdbRating}}
{{imdbVotes}}
{{imdbID}}
{{Type}}
{{DVD}}
{{BoxOffice}}
{{Production}}
{{Website}}
{{totalSeasons}}
{{YoutubeEmbed}}

Note: The data for some tags come as a list (e.g. {{Actors}}). To make these into a valid frontmatter list you can sorround them with square brakets: [{{Actors}}]

Pre- and Suffix

You can define a pre- and suffix to be applied to the data. this is done by using {{tag|prefix|suffix}}. (if you want to use the "|" character, it can be escaped using "\|").

Example: {{Director|"[[|]]"}} will create an internal link of the form "[[Director]]"

When the data is in the form of a list, all transformations will be applied for each item in the list.

Regex Transformation

Additionally you can also give a regex transform to transform the data to your liking by using {{tag|prefix|suffix|regexTransform}}.

Inside a regex transformation every regular expression given inside <$ $> delimiters will be replaced by the matching string from the input. This allows you to bring the data into the form you need it.

Examples:

  • {{Actors|"[[|]]"|<$\w+$$>, <$^\w+$>\|@<$^\w+$> <$\w+$$>}}. This regex transformation will transform the "Actors" data in the form of Firstname Lastname into a link in the form of "[[Lastname, Firstname|@Firstname Lastname]]" (see issue #21).
  • {{Ratings|"|"|<$Rotten Tomatoes\: .*$>}}. This regex transformation will result in only the Rotten Tomatoes rating to be shown.

When a regex transformation results in an empty string pre- and suffix will not be applied.

You can generate an example template in the plugin settings. If no template is given, this default template is used.

String Functions

Finally you can also use javascript functions to transform the input by giving the function name as the 4th argument. This can for example be used to transform the data into all lowercase:

{{Genre||||toLowerCase}}

Regenerating notes

When trying to create a note for a movie that already exists you will be asked if you want to overwrite the existing note. If you want to keep something from the old note in the newly generated one you can make use of the delimiter string:

%%==MOVIEGRABBER_KEEP==%%

Everything below this will be transfered to the new note when overwriting.

Saving Poster Images Locally

When this feature is enabled, movie poster images will be saved to a specified location as .jpg files. To access the image link you can use the template tag {{PosterLocal}}.

Using the generated notes with Dataview and custom CSS

Using a dataview table in combination with a custom css snippet, you can use these notes to create an interactive display for your movies.

grafik

Movies.-.not.seen.-.Plugin-Test-Vault.-.Obsidian.v1.4.13.2023-09-21.17-02-49.mp4

To use this, copy aditional_css/CardViewMovies.css to your vault's snippets folder (.obsidian/snippets/) and put

---
cssclass: CardViewMovies
---

at the top of your note.

A dataview query for movies not yet seen could look something like this:

```dataview
TABLE country, year, length, trailer_embed, availability, rating, seen
FROM "Movies" WHERE type = "movie" AND seen = Null
```

Note that the cards need at least country, year, length, trailer_embed in the querry to show a card.

eb84e7e8b72a19542ac9510d4053a36bbfbc310b

About

obsidian.md plugin to grab data from public movie Databases and make them into a note that can be used with dataview querries

Resources

License

Stars

Watchers

Forks

Packages

No packages published