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 = {u'hash': 137, u'format': 6, u'series': 44, u'tvdb_id': 88, u'imdb_id': 110, u'audio_codec': 2, u'year': 44, u'hearing_impaired': 1, u'episode': 11, u'title': 22, u'season': 11, u'video_codec': 4, u'resolution': 4, u'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 = {u'hash': 62, u'hearing_impaired': 1, u'audio_codec': 2, u'title': 23, u'video_codec': 4, u'format': 6, u'year': 12, u'resolution': 4, u'release_group': 11, u'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)[source]

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

Parameters:path (str) – path to the video.
Returns:found subtitles with their languages.
Return type:dict
subliminal.video.scan_video(path, subtitles=True, embedded_subtitles=True)[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.
Returns:

the scanned video.

Return type:

Video

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

Scan path for videos and their subtitles.

Params path:

existing directory path to scan.

Parameters:
  • subtitles (bool) – scan for subtitles with the same name.
  • embedded_subtitles (bool) – scan for embedded 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