Movie-cli-2 : a command line tool to fetch info from omdbapi and build a movie database

movie-cli-2

a CLI tool to fetch movies and tv series details from omdbApi.com and tmdb, or comparing two movies.
It can optionally save the movie metadata to the clipboard or as a markdown file in a custom folder. Metadata are formatted as property:: value for Logseq
current version : 1.1.0 (2022-01-17)

install

npm i -g github:cannibalox/movie-cli-2

USAGE

open a terminal and type movie followed by search terms. the script will display relevant movie details and copy them to the clipboard, formatted as logseq properties, it can also directly save them as a markdown file in your fodler of choice (file will be named star wars [[1977]].md) .

Usage: movie [title] or [movie1]::[movie2]

Options:
  -v, --version   output the current version
  -k, --key       set and save your apîkeys
  -r, --reset     resets options and clear keys
  -s, --settings  define settings
  -h, --help      display help for command

terminal showing info (left) | movie info saved as a md file inside Logseq using custom.css (right)


demo
ss_WindowsTerminal_Windows_PowerShell_20230112_Y8WrqVr4In

requirements :

  • NodeJS > 17.5
  • an api key from omdbapi.com to fetch movie details
  • a TMDB api key is required to fetch “original title” property

configuration

  • on first start, the program should enter configuration mode and will let you choose options (eg: define which metadata to fetch, auto-save to clipboard, etc…)
  • please get your own api keys for omdbapi (OMDb API - The Open Movie Database) and TMDB (https://www.themoviedb.org/settings/api) - tmdb is needed for original-titles (for non english movies)
  • the configuration is automatically saved, use movie -v to see the location of the config file
  • use movie --reset or movie --settings to modify the configuration after the first run

setup is done via some questions

for logseq users:

  • the movie metadata can be saved as a markdown file as property:: value. it can add a title:: and fill default tags::
  • don’t forget to set your date format in the config file to match your logseq date format (like yyyymmdd | yyyy-mm-dd | dddd, MMM do, yyyy | etc…) to get the correct watched:: [[%mydate%]] link
    (refer to logseq docs and GitHub - felixge/node-dateformat: A node.js package for Steven Levithan's excellent dateFormat() function. to see available formats)
  • the script can optionally asks for a custom rating and watched date, they will be saved as properties rating:: (converted to star) and watched:: [[%date%]] (a few custom arguments are possible)
  • filepaths should point to your logseq journals and pages folder (eg: ‘c:\logseq-graph\journals’, ‘d:/logseq/pages’ or ‘/Users/path/to/logseq/pages/or/journal/’)
    the folders must exist prior to the execution. the trailing \ or / is not required.
  • the script can optionally set a log line in the daily journal at the %watched date% defined for the movie
  • I recommand to use the logseq config.edn option :
    :property/separated-by-commas #{:tags :genre : director :writer :actors}
    to trigger auto linking for some properties.

ss_Logseq_Logseq_20230112_wOSbsTATWL

new features and improvements

the script is forked from Mayankchd’s movie-cli, tailored for my personal movie tracking workflow in Logseq.
notable differences and new features :

  • added a list of matching titles to pick from, to disambiguate titles like Alone (2008) vs Alone (2020)
  • added save to clipboard and save to file options
  • added original-title:: property using TMDB api for non-English titles
  • added custom inputs (ratings, watched date)
  • refactor code, updated to ECMAScript modules, update dependencies and removed isomorphic-fetch.

limitations

this tool was made for my personal workflow and is provided as-is, for now, it only saves in markdown format, not org. Only tested in Windows, but it should work in *nix and mac too. Remeber to backup your logseq graph and make sure to test outputs in a temp folder before directing it to your main graph.