Skip to content

Usage as a CLI script

Emeric edited this page Dec 7, 2020 · 2 revisions

Installation

  • Download latest version from the release page and extract it anywhere you want

  • Make it executable

$ wget https://raw.githubusercontent.com/emericg/OpenSubtitlesDownload/master/OpenSubtitlesDownload.py
$ chmod u+x OpenSubtitlesDownload.py

Usage

  • Pass one or more video file(s) without any prefix
  • Use custom arguments to change settings
  • The order of the arguments is not important

Force CLI mode

By default, the script auto-detect which GUI you are using (GNOME or KDE based desktop environment) and fallback to CLI mode only if no compatible desktop environment is running (like unknown DE or macOS/Windows). You may want to manually edit the script and set the gui variable to cli.

opt_gui = 'cli'

Exemple:

./OpenSubtitlesDownload.py --cli --auto '/media/video1.mkv' '/media/video2.mp4'

Arguments available (use either short or long prefix):

  • --help (or -h) [Show help and exit]
  • --verbose (or -v) [Force verbose output]
  • --cli [Force CLI mode]
  • --gui GUI (or -g GUI) [Select the GUI type, from these options: auto, kde, gnome, cli (default: --gui auto)]
  • --lang LANG (or -l LANG) [Specify the language in which the subtitles should be downloaded (default: --lang eng). Syntax: "-l eng,fre" to search in both language. "-l eng -l fre" to download both language)]
  • --skip (or -i) [Skip search if an existing subtitles file is detected]
  • --search MODE (or -s MODE) [Search mode: hash, filename, hash_then_filename, hash_and_filename (default: hash_then_filename)]
  • --select MODE (or -t MODE) [Selection mode: manual, default, auto]
  • --auto [Trigger automatic selection and download of the best subtitles found]
  • --output PATH (or -o PATH) [Override subtitles download path]