Providers
*********

class subliminal.providers.TimeoutSafeTransport(timeout, *args, **kwargs)

   Timeout support for "xmlrpc.client.SafeTransport".

class subliminal.providers.ParserBeautifulSoup(markup, parsers, **kwargs)

   A "bs4.BeautifulSoup" that picks the first parser available in
   *parsers*.

   Parameters:
      * **markup** -- markup for the "bs4.BeautifulSoup".

      * **parsers** (*list*) -- parser names, in order of
        preference.

class subliminal.providers.Provider

   Base class for providers.

   If any configuration is possible for the provider, like
   credentials, it must take place during instantiation.

   Raise:
      "ConfigurationError" if there is a configuration error

   languages = set([])

      Supported set of "Language"

   video_types = (<class 'subliminal.video.Episode'>, <class 'subliminal.video.Movie'>)

      Supported video types

   required_hash = None

      Required hash, if any

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   classmethod check(video)

      Check if the *video* can be processed.

      The *video* is considered invalid if not an instance of
      "video_types" or if the "required_hash" is not present in
      "hashes" attribute of the *video*.

      Parameters:
         **video** ("Video") -- the video to check.

      Returns:
         *True* if the *video* is valid, *False* otherwise.

      Return type:
         bool

   query(*args, **kwargs)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


Addic7ed
========

subliminal.providers.addic7ed.series_year_re = <_sre.SRE_Pattern object>

   Series header parsing regex

class subliminal.providers.addic7ed.Addic7edSubtitle(language, hearing_impaired, page_link, series, season, episode, title, year, version, download_link)

   Addic7ed Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.addic7ed.Addic7edProvider(username=None, password=None)

   Addic7ed Provider.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   _get_show_ids(**kw)

      Get the "dict" of show ids per series by querying the
      *shows.php* page.

      Returns:
         show id per series, lower case and without quotes.

      Return type:
         dict

   _search_show_id(**kw)

      Search the show id from the *series* and *year*.

      Parameters:
         * **series** (*str*) -- series of the episode.

         * **year** (*int*) -- year of the series, if any.

      Returns:
         the show id, if found.

      Return type:
         int

   get_show_id(series, year=None, country_code=None)

      Get the best matching show id for *series*, *year* and
      *country_code*.

      First search in the result of "_get_show_ids()" and fallback on
      a search with "_search_show_id()".

      Parameters:
         * **series** (*str*) -- series of the episode.

         * **year** (*int*) -- year of the series, if any.

         * **country_code** (*str*) -- country code of the series,
           if any.

      Returns:
         the show id, if found.

      Return type:
         int

   query(series, season, year=None, country=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


LegendasTv
==========

subliminal.providers.legendastv.type_map = {'C': 'episode', 'M': 'movie', 'S': 'episode'}

   Conversion map for types

subliminal.providers.legendastv.season_re = <_sre.SRE_Pattern object>

   BR title season parsing regex

subliminal.providers.legendastv.downloads_re = <_sre.SRE_Pattern object>

   Downloads parsing regex

subliminal.providers.legendastv.rating_re = <_sre.SRE_Pattern object>

   Rating parsing regex

subliminal.providers.legendastv.timestamp_re = <_sre.SRE_Pattern object>

   Timestamp parsing regex

subliminal.providers.legendastv.releases_key = 'subliminal.providers.legendastv:releases|{archive_id}'

   Cache key for releases

class subliminal.providers.legendastv.LegendasTVArchive(id, name, pack, featured, link, downloads=0, rating=0, timestamp=None)

   LegendasTV Archive.

   Parameters:
      * **id** (*str*) -- identifier.

      * **name** (*str*) -- name.

      * **pack** (*bool*) -- contains subtitles for multiple
        episodes.

      * **pack** -- featured.

      * **link** (*str*) -- link.

      * **downloads** (*int*) -- download count.

      * **rating** (*int*) -- rating (0-10).

      * **timestamp** (*datetime.datetime*) -- timestamp.

   id = None

      Identifier

   name = None

      Name

   pack = None

      Pack

   featured = None

      Featured

   link = None

      Link

   downloads = None

      Download count

   rating = None

      Rating (0-10)

   timestamp = None

      Timestamp

   content = None

      Compressed content as "rarfile.RarFile" or "zipfile.ZipFile"

class subliminal.providers.legendastv.LegendasTVSubtitle(language, type, title, year, imdb_id, season, archive, name)

   LegendasTV Subtitle.

   get_matches(video, hearing_impaired=False)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.legendastv.LegendasTVProvider(username=None, password=None)

   LegendasTV Provider.

   Parameters:
      * **username** (*str*) -- username.

      * **password** (*str*) -- password.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   search_titles(**kw)

      Search for titles matching the *title*.

      Parameters:
         **title** (*str*) -- the title to search for.

      Returns:
         found titles.

      Return type:
         dict

   get_archives(**kw)

      Get the archive list from a given *title_id* and
      *language_code*.

      Parameters:
         * **title_id** (*int*) -- title id.

         * **language_code** (*int*) -- language code.

      Returns:
         the archives.

      Return type:
         list of "LegendasTVArchive"

   download_archive(archive)

      Download an archive's "content".

      Parameters:
         **archive** ("LegendasTVArchive") -- the archive to download
         "content" of.

   query(language, title, season=None, episode=None, year=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


NapiProjekt
===========

subliminal.providers.napiprojekt.get_subhash(hash)

   Get a second hash based on napiprojekt's hash.

   Parameters:
      **hash** (*str*) -- napiprojekt's hash.

   Returns:
      the subhash.

   Return type:
      str

class subliminal.providers.napiprojekt.NapiProjektSubtitle(language, hash)

   NapiProjekt Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.napiprojekt.NapiProjektProvider

   NapiProjekt Provider.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   query(language, hash)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


OpenSubtitles
=============

class subliminal.providers.opensubtitles.OpenSubtitlesSubtitle(language, hearing_impaired, page_link, subtitle_id, matched_by, movie_kind, hash, movie_name, movie_release_name, movie_year, movie_imdb_id, series_season, series_episode, filename, encoding)

   OpenSubtitles Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.opensubtitles.OpenSubtitlesProvider(username=None, password=None)

   OpenSubtitles Provider.

   Parameters:
      * **username** (*str*) -- username.

      * **password** (*str*) -- password.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   query(languages, hash=None, size=None, imdb_id=None, query=None, season=None, episode=None, tag=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"

exception subliminal.providers.opensubtitles.OpenSubtitlesError

   Base class for non-generic "OpenSubtitlesProvider" exceptions.

exception subliminal.providers.opensubtitles.Unauthorized

   Exception raised when status is '401 Unauthorized'.

exception subliminal.providers.opensubtitles.NoSession

   Exception raised when status is '406 No session'.

exception subliminal.providers.opensubtitles.DownloadLimitReached

   Exception raised when status is '407 Download limit reached'.

exception subliminal.providers.opensubtitles.InvalidImdbid

   Exception raised when status is '413 Invalid ImdbID'.

exception subliminal.providers.opensubtitles.UnknownUserAgent

   Exception raised when status is '414 Unknown User Agent'.

exception subliminal.providers.opensubtitles.DisabledUserAgent

   Exception raised when status is '415 Disabled user agent'.

exception subliminal.providers.opensubtitles.ServiceUnavailable

   Exception raised when status is '503 Service Unavailable'.

subliminal.providers.opensubtitles.checked(response)

   Check a response status before returning it.

   Parameters:
      **response** -- a response from a XMLRPC call to OpenSubtitles.

   Returns:
      the response.

   Raise:
      "OpenSubtitlesError"


Podnapisi
=========

class subliminal.providers.podnapisi.PodnapisiSubtitle(language, hearing_impaired, page_link, pid, releases, title, season=None, episode=None, year=None)

   Podnapisi Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.podnapisi.PodnapisiProvider

   Podnapisi Provider.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   query(language, keyword, season=None, episode=None, year=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


Shooter
=======

class subliminal.providers.shooter.ShooterSubtitle(language, hash, download_link)

   Shooter Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.shooter.ShooterProvider

   Shooter Provider.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   query(language, filename, hash=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


SubsCenter
==========

class subliminal.providers.subscenter.SubsCenterSubtitle(language, hearing_impaired, page_link, series, season, episode, title, subtitle_id, subtitle_key, downloaded, releases)

   SubsCenter Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.subscenter.SubsCenterProvider(username=None, password=None)

   SubsCenter Provider.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   _search_url_titles(**kw)

      Search the URL titles by kind for the given *title*.

      Parameters:
         **title** (*str*) -- title to search for.

      Returns:
         the URL titles by kind.

      Return type:
         collections.defaultdict

   query(title, season=None, episode=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"


TheSubDB
========


TVsubtitles
===========

class subliminal.providers.tvsubtitles.TVsubtitlesSubtitle(language, page_link, subtitle_id, series, season, episode, year, rip, release)

   TVsubtitles Subtitle.

   get_matches(video)

      Get the matches against the *video*.

      Parameters:
         **video** ("Video") -- the video to get the matches with.

      Returns:
         matches of the subtitle.

      Return type:
         set

class subliminal.providers.tvsubtitles.TVsubtitlesProvider

   TVsubtitles Provider.

   initialize()

      Initialize the provider.

      Must be called when starting to work with the provider. This is
      the place for network initialization or login operations.

      Note: This is called automatically when entering the *with*
        statement

   terminate()

      Terminate the provider.

      Must be called when done with the provider. This is the place
      for network shutdown or logout operations.

      Note: This is called automatically when exiting the *with*
        statement

   search_show_id(**kw)

      Search the show id from the *series* and *year*.

      Parameters:
         * **series** (*str*) -- series of the episode.

         * **year** (*int*) -- year of the series, if any.

      Returns:
         the show id, if any.

      Return type:
         int

   get_episode_ids(**kw)

      Get episode ids from the show id and the season.

      Parameters:
         * **show_id** (*int*) -- show id.

         * **season** (*int*) -- season of the episode.

      Returns:
         episode ids per episode number.

      Return type:
         dict

   query(series, season, episode, year=None)

      Query the provider for subtitles.

      Arguments should match as much as possible the actual parameters
      for querying the provider

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   list_subtitles(video, languages)

      List subtitles for the *video* with the given *languages*.

      This will call the "query()" method internally. The parameters
      passed to the "query()" method may vary depending on the amount
      of information available in the *video*.

      Parameters:
         * **video** ("Video") -- video to list subtitles for.

         * **languages** (set of "Language") -- languages to search
           for.

      Returns:
         found subtitles.

      Return type:
         list of "Subtitle"

      Raise:
         "ProviderError"

   download_subtitle(subtitle)

      Download *subtitle*'s "content".

      Parameters:
         **subtitle** ("Subtitle") -- subtitle to download.

      Raise:
         "ProviderError"
