How it works¶
Providers¶
Subliminal uses multiple providers to give users a vast choice and have a better chance to find the best matching subtitles. Current supported providers are:
Addic7ed
LegendasTV
NapiProjekt
OpenSubtitles
Podnapisi
Shooter
TheSubDB
TvSubtitles
Providers all inherit the same Provider
base class and thus share the same API.
They are registered on the subliminal.providers
entry point and are exposed through the
provider_manager
for easy access.
To work with multiple providers seamlessly, the ProviderPool
exposes the same API but
distributes it to its providers and AsyncProviderPool
does it asynchronously.
Scoring¶
Rating subtitles and comparing them is probably the most difficult part and this is where subliminal excels with its powerful scoring algorithm.
Using guessit and enzyme, subliminal extracts properties of the video and match them with the properties of the subtitles found with the providers.
Equations in subliminal.score
give a score to each property (called a match). The more matches the video and
the subtitle have, the higher the score computed with compute_score()
gets.
Libraries¶
Various libraries are used by subliminal and are key to its success:
guessit to guess information from filenames
enzyme to detect embedded subtitles in videos and read other video metadata
babelfish to work with languages
requests to make human readable HTTP requests
BeautifulSoup to parse HTML and XML
dogpile.cache to cache intermediate search results
stevedore to manage the provider entry point
chardet to detect subtitles’ encoding
pysrt to validate downloaded subtitles