Video

subliminal.video.VIDEO_EXTENSIONS

Video extensions

subliminal.video.SUBTITLE_EXTENSIONS

Subtitle extensions

class subliminal.video.Video(name, format=None, release_group=None, resolution=None, video_codec=None, audio_codec=None, imdb_id=None, hashes=None, size=None, subtitle_languages=None)[source]

Base class for videos.

Represent a video, existing or not. Attributes have an associated score based on equations defined in score.

Parameters:
  • name (str) – name or path of the video.
  • format (str) – format of the video (HDTV, WEB-DL, BluRay, ...).
  • release_group (str) – release group of the video.
  • resolution (str) – resolution of the video stream (480p, 720p, 1080p or 1080i).
  • video_codec (str) – codec of the video stream.
  • audio_codec (str) – codec of the main audio stream.
  • imdb_id (int) – IMDb id of the video.
  • hashes (dict) – hashes of the video file by provider names.
  • size (int) – size of the video file in bytes.
  • subtitle_languages (set) – existing subtitle languages
scores = {}

Score by match property

name = None

Name or path of the video

format = None

Format of the video (HDTV, WEB-DL, BluRay, ...)

release_group = None

Release group of the video

resolution = None

Resolution of the video stream (480p, 720p, 1080p or 1080i)

video_codec = None

Codec of the video stream

audio_codec = None

Codec of the main audio stream

imdb_id = None

IMDb id of the video

hashes = None

Hashes of the video file by provider names

size = None

Size of the video file in bytes

subtitle_languages = None

Existing subtitle languages

exists

Test whether the video exists.

age

Age of the video.

classmethod fromguess(name, guess)[source]

Create an Episode or a Movie with the given name based on the guess.

Parameters:
  • name (str) – name of the video.
  • guess (dict) – guessed data, like a Guess instance.
Raise:

ValueError if the type of the guess is invalid

classmethod fromname(name)[source]

Shortcut for fromguess() with a guess guessed from the name.

Parameters:name (str) – name of the video.
class subliminal.video.Episode(name, series, season, episode, format=None, release_group=None, resolution=None, video_codec=None, audio_codec=None, imdb_id=None, hashes=None, size=None, subtitle_languages=None, title=None, year=None, tvdb_id=None)[source]

Episode Video.

Scores are defined by a set of equations, see solve_episode_equations()

Parameters:
  • series (str) – series of the episode.
  • season (int) – season number of the episode.
  • episode (int) – episode number of the episode.
  • title (str) – title of the episode.
  • year (int) – year of series.
  • tvdb_id (int) – TVDB id of the episode
scores = {'hash': 137, 'format': 6, 'series': 44, 'tvdb_id': 88, 'imdb_id': 110, 'audio_codec': 2, 'year': 44, 'hearing_impaired': 1, 'episode': 11, 'title': 22, 'season': 11, 'video_codec': 4, 'resolution': 4, 'release_group': 11}

Score by match property

series = None

Series of the episode

season = None

Season number of the episode

episode = None

Episode number of the episode

title = None

Title of the episode

year = None

Year of series

tvdb_id = None

TVDB id of the episode

class subliminal.video.Movie(name, title, format=None, release_group=None, resolution=None, video_codec=None, audio_codec=None, imdb_id=None, hashes=None, size=None, subtitle_languages=None, year=None)[source]

Movie Video.

Scores are defined by a set of equations, see solve_movie_equations()

Parameters:
  • title (str) – title of the movie.
  • year (int) – year of the movie
scores = {'hash': 62, 'hearing_impaired': 1, 'audio_codec': 2, 'title': 23, 'video_codec': 4, 'format': 6, 'year': 12, 'resolution': 4, 'release_group': 11, 'imdb_id': 62}

Score by match property

title = None

Title of the movie

year = None

Year of the movie

subliminal.video.search_external_subtitles(path, directory=None)[source]

Search for external subtitles from a video path and their associated language.

Unless directory is provided, search will be made in the same directory as the video file.

Parameters:
  • path (str) – path to the video.
  • directory (str) – directory to search for subtitles.
Returns:

found subtitles with their languages.

Return type:

dict

subliminal.video.scan_video(path, subtitles=True, embedded_subtitles=True, subtitles_dir=None)[source]

Scan a video and its subtitle languages from a video path.

Parameters:
  • path (str) – existing path to the video.
  • subtitles (bool) – scan for subtitles with the same name.
  • embedded_subtitles (bool) – scan for embedded subtitles.
  • subtitles_dir (str) – directory to search for subtitles.
Returns:

the scanned video.

Return type:

Video

subliminal.video.scan_videos(path, subtitles=True, embedded_subtitles=True, subtitles_dir=None)[source]

Scan path for videos and their subtitles.

Parameters:
  • path (str) – existing directory path to scan.
  • subtitles (bool) – scan for subtitles with the same name.
  • embedded_subtitles (bool) – scan for embedded subtitles.
  • subtitles_dir (str) – directory to search for subtitles.
Returns:

the scanned videos.

Return type:

list of Video

subliminal.video.hash_opensubtitles(video_path)[source]

Compute a hash using OpenSubtitles’ algorithm.

Parameters:video_path (str) – path of the video.
Returns:the hash.
Return type:str
subliminal.video.hash_thesubdb(video_path)[source]

Compute a hash using TheSubDB’s algorithm.

Parameters:video_path (str) – path of the video.
Returns:the hash.
Return type:str
subliminal.video.hash_napiprojekt(video_path)[source]

Compute a hash using NapiProjekt’s algorithm.

Parameters:video_path (str) – path of the video.
Returns:the hash.
Return type:str