Subtitle

class subliminal.subtitle.Subtitle(language, hearing_impaired=False)

Base class for subtitle

Parameters:
  • language (babelfish.Language) – language of the subtitle
  • hearing_impaired (bool) – True if the subtitle is hearing impaired, False otherwise
compute_matches(video)

Compute the matches of the subtitle against the video

Parameters:video (Video) – the video to compute the matches against
Returns:matches of the subtitle
Return type:set
compute_score(video, hi_score_adjust=0)

Compute the score of the subtitle against the video

There are equivalent matches so that a provider can match one element or its equivalent. This is to give all provider a chance to have a score in the same range without hurting quality.

  • Matching Video‘s hashes is equivalent to matching everything else
  • Matching Episode‘s season and episode is equivalent to matching Episode‘s title
  • Matching Episode‘s tvdb_id is equivalent to matching Episode‘s series
Parameters:
  • video (Video) – the video to compute the score against
  • hi_score_adjust – adjust hearing impaired matched videos by this value
Returns:

score of the subtitle

Return type:

int

subliminal.subtitle.get_subtitle_path(video_path, language=None)

Create the subtitle path from the given video_path and language

Parameters:
  • video_path (string) – path to the video
  • language (babelfish.Language or None) – language of the subtitle to put in the path
Returns:

path of the subtitle

Return type:

string

subliminal.subtitle.is_valid_subtitle(subtitle_text)

Check if a subtitle text is a valid SubRip format

Returns:True if the subtitle is valid, False otherwise
Return type:bool
subliminal.subtitle.compute_guess_matches(video, guess)

Compute matches between a video and a guess

Parameters:
  • video (Video) – the video to compute the matches on
  • guess (guessit.Guess) – the guess to compute the matches on
Returns:

matches of the guess

Return type:

set