media.subtitles
#
- class platypush.plugins.media.subtitles.MediaSubtitlesPlugin(username, password, language=None, **kwargs)[source]#
Bases:
Plugin
Plugin to get video subtitles from OpenSubtitles
Requires:
python-opensubtitles (
pip install -e 'git+https://github.com/agonzalezro/python-opensubtitles#egg=python-opensubtitles'
)webvtt (
pip install webvtt-py
), optional, to convert srt subtitles into vtt format ready for web streaming
- download(link, media_resource=None, path=None, convert_to_vtt=False)[source]#
Downloads a subtitle link (.srt/.vtt file or gzip/zip OpenSubtitles archive link) to the specified directory
- Parameters:
link (str) – Local subtitles file or OpenSubtitles gzip download link
path (str) – Path where the subtitle file will be downloaded (default: temporary file under /tmp)
media_resource (str) – Name of the media resource. If set and if it’s a media local file then the subtitles will be saved in the same folder
convert_to_vtt (bool) – If set to True, then the downloaded subtitles will be converted to VTT format (default: no conversion)
- Returns:
dict.
Format:
{ "filename": "/path/to/subtitle/file.srt" }
- search(resource, language=None)[source]#
Alias for
get_subtitles()
.