media.subtitles
#
Description#
Plugin to get video subtitles from OpenSubtitles.
Configuration#
media.subtitles:
# [Required]
# Your OpenSubtitles username
username:
# [Required]
# Your OpenSubtitles password
password:
# [Optional]
# Preferred language name, ISO639 code or OpenSubtitles
# language ID to be used for the subtitles. Also supports an (ordered)
# list of preferred languages
# language:
Dependencies#
pip
pip install webvtt-py python-opensubtitles
Debian
apt install python3-webvtt
Actions#
Module reference#
- class platypush.plugins.media.subtitles.MediaSubtitlesPlugin(username, password, language=None, **kwargs)[source]#
Bases:
Plugin
Plugin to get video subtitles from OpenSubtitles.
- 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()
.