Score

This module provides the default implementation of the compute_score parameter in download_best_subtitles() and download_best_subtitles().

Note

To avoid unnecessary dependency on sympy and boost subliminal’s import time, the resulting scores are hardcoded here and manually updated when the set of equations change.

Available matches:

  • hash

  • title

  • year

  • series

  • season

  • episode

  • release_group

  • format

  • audio_codec

  • resolution

  • hearing_impaired

  • video_codec

  • series_imdb_id

  • imdb_id

  • tvdb_id

subliminal.score.episode_scores = {'audio_codec': 3, 'episode': 30, 'format': 7, 'hash': 359, 'hearing_impaired': 1, 'release_group': 15, 'resolution': 2, 'season': 30, 'series': 180, 'video_codec': 2, 'year': 90}

Scores for episodes

subliminal.score.movie_scores = {'audio_codec': 3, 'format': 7, 'hash': 119, 'hearing_impaired': 1, 'release_group': 15, 'resolution': 2, 'title': 60, 'video_codec': 2, 'year': 30}

Scores for movies

subliminal.score.equivalent_release_groups = ({'DIMENSION', 'LOL'}, {'ASAP', 'FLEET', 'IMMERSE'})

Equivalent release groups

subliminal.score.get_equivalent_release_groups(release_group)[source]

Get all the equivalents of the given release group.

Parameters

release_group (str) – the release group to get the equivalents of.

Returns

the equivalent release groups.

Return type

set

subliminal.score.get_scores(video)[source]

Get the scores dict for the given video.

This will return either episode_scores or movie_scores based on the type of the video.

Parameters

video (Video) – the video to compute the score against.

Returns

the scores dict.

Return type

dict

subliminal.score.compute_score(subtitle, video, hearing_impaired=None)[source]

Compute the score of the subtitle against the video with hearing_impaired preference.

compute_score() uses the Subtitle.get_matches method and applies the scores (either from episode_scores or movie_scores) after some processing.

Parameters
  • subtitle (Subtitle) – the subtitle to compute the score of.

  • video (Video) – the video to compute the score against.

  • hearing_impaired (bool) – hearing impaired preference.

Returns

score of the subtitle.

Return type

int