Providers¶
-
subliminal.providers.
get_version
(version)[source]¶ Put the version in the major.minor form.
Parameters: version (str) – the full version. Returns: the major.minor form of the version. Return type: str
-
class
subliminal.providers.
TimeoutSafeTransport
(timeout, *args, **kwargs)[source]¶ Timeout support for
xmlrpc.client.SafeTransport
.
-
class
subliminal.providers.
ParserBeautifulSoup
(markup, parsers, **kwargs)[source]¶ 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
- markup – markup for the
-
class
subliminal.providers.
Provider
[source]¶ 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-
video_types
= (<class 'subliminal.video.Episode'>, <class 'subliminal.video.Movie'>)¶ Supported video types
-
required_hash
= None¶ Required hash, if any
-
initialize
()[source]¶ 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
()[source]¶ 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)[source]¶ Check if the video can be processed.
The video is considered invalid if not an instance of
video_types
or if therequired_hash
is not present inhashes
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)[source]¶ 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)[source]¶ List subtitles for the video with the given languages.
This will call the
query()
method internally. The parameters passed to thequery()
method may vary depending on the amount of information available in the video.Parameters: Returns: found subtitles.
Return type: list of
Subtitle
Raise:
-
download_subtitle
(subtitle)[source]¶ Download subtitle‘s
content
.Parameters: subtitle ( Subtitle
) – subtitle to download.Raise: ProviderError
-