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 againstReturns: 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 matchingEpisode
‘s title - Matching
Episode
‘s tvdb_id is equivalent to matchingEpisode
‘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
- Matching
- language (
-
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