Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 2.24 KB

how_it_works.rst

File metadata and controls

52 lines (41 loc) · 2.24 KB

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
  • Wizdom

Providers all inherit the same :class:`~subliminal.providers.Provider` base class and thus share the same API. They are registered on the subliminal.providers entry point and are exposed through the :data:`~subliminal.extensions.provider_manager` for easy access.

To work with multiple providers seamlessly, the :class:`~subliminal.core.ProviderPool` exposes the same API but distributes it to its providers and :class:`~subliminal.core.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 :mod:`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 :func:`~subliminal.score.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