Skip to content

Diaoul/subliminal

Repository files navigation

Subliminal

Subtitles, faster than your thoughts.

Latest Version Documentation Status Code coverage License Join the chat at https://gitter.im/Diaoul/subliminal Discord
Project page:https://github.com/Diaoul/subliminal
Documentation:https://subliminal.readthedocs.org/

Usage

CLI

Download English subtitles:

$ subliminal download -l en The.Big.Bang.Theory.S05E18.HDTV.x264-LOL.mp4
Collecting videos  [####################################]  100%
1 video collected / 0 video ignored / 0 error
Downloading subtitles  [####################################]  100%
Downloaded 1 subtitle

Library

Download best subtitles in French and English for videos less than two weeks old in a video folder:

#!/usr/bin/env python

from datetime import timedelta

from babelfish import Language
from subliminal import download_best_subtitles, region, save_subtitles, scan_videos

# configure the cache
region.configure('dogpile.cache.dbm', arguments={'filename': 'cachefile.dbm'})

# scan for videos newer than 2 weeks and their existing subtitles in a folder
videos = scan_videos('/video/folder', age=timedelta(weeks=2))

# download best subtitles
subtitles = download_best_subtitles(videos, {Language('eng'), Language('fra')})

# save them to disk, next to the video
for v in videos:
    save_subtitles(v, subtitles[v])

Docker

Run subliminal in a docker container:

$ docker run --rm --name subliminal -v subliminal_cache:/usr/src/cache -v /tvshows:/tvshows -it diaoulael/subliminal download -l en /tvshows/The.Big.Bang.Theory.S05E18.HDTV.x264-LOL.mp4

Installation

For a better isolation with your system you should use a dedicated virtualenv. The preferred installation method is to use pipx that does that for you:

$ pipx install subliminal

Subliminal can be also be installed as a regular python module by running:

$ pip install --user subliminal

If you want to modify the code, fork this repo, clone your fork locally and install a development version:

$ git clone https://github.com/<my-username>/subliminal
$ cd subliminal
$ pip install --user -e '.[dev,test,docs]'

Nautilus/Nemo integration

See the dedicated project page for more information.

Dolphin integration

See this Gist.