media.webtorrent
Platypush documentation
media.webtorrent
- class platypush.plugins.media.webtorrent.MediaWebtorrentPlugin(webtorrent_bin=None, webtorrent_port=None, *args, **kwargs)[source]
Bases:
MediaPlugin
Plugin to download and stream videos using webtorrent
Requires:
webtorrent installed on your system (
npm install -g webtorrent
)webtorrent-cli installed on your system (
npm install -g webtorrent-cli
)A media plugin configured for streaming (e.g. media.mplayer, media.vlc, media.mpv or media.omxplayer)
- __init__(webtorrent_bin=None, webtorrent_port=None, *args, **kwargs)[source]
media.webtorrent will use the default media player plugin you have configured (e.g. mplayer, omxplayer, mpv) to stream the torrent.
- download(resource, **kwargs)[source]
Download a media URL
- Parameters:
url – Media URL
filename – Media filename (default: URL filename)
directory – Destination directory (default: download_dir)
- Returns:
The absolute path to the downloaded file
- play(resource, player=None, download_only=False, **player_args)[source]
Download and stream a torrent
- Parameters:
resource (str) – Play a resource, as a magnet link, torrent URL or torrent file path
player (str) – If set, use this plugin type as a player for the torrent. Supported types: ‘mplayer’, ‘vlc’, ‘omxplayer’, ‘chromecast’, ‘mpv’. If not set, then the default configured media plugin will be used.
player_args (dict) – Any arguments to pass to the player plugin’s play() method
download_only (bool) – If false then it will start streaming the torrent on the local player once the download starts, otherwise it will just download it (default: false)