media.vlc
media.vlc
- class platypush.plugins.media.vlc.MediaVlcPlugin(args=None, fullscreen=False, volume=100, *argv, **kwargs)[source]
Plugin to control vlc instances
Requires:
python-vlc (
pip install python-vlc
)vlc executable on your system
- __init__(args=None, fullscreen=False, volume=100, *argv, **kwargs)[source]
Create the vlc wrapper.
- Parameters:
args (list[str]) – List of extra arguments to pass to the VLC executable (e.g.
['--sub-language=en', '--snapshot-path=/mnt/snapshots']
)fullscreen (bool) – Set to True if you want media files to be opened in fullscreen by default (can be overridden by .play()) (default: False)
volume (int) – Default media volume (default: 100)
- download(url, filename=None, directory=None)
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
- get_media_file_duration(filename)
Get the duration of a media file in seconds. Requires ffmpeg
- next()
Play the next item in the queue
- play(resource=None, subtitles=None, fullscreen=None, volume=None)[source]
Play a resource.
- Parameters:
resource (str) – Resource to play - can be a local file or a remote URL (default: None == toggle play).
subtitles (str) – Path to optional subtitle file
fullscreen (bool) – Set to explicitly enable/disable fullscreen (default: fullscreen configured value or False)
volume – Set to explicitly set the playback volume (default: volume configured value or 100)
- search(query, types=None, queue_results=False, autoplay=False, search_timeout=60)
Perform a video search.
- Parameters:
query (str) – Query string, video name or partial name
types (list) – Video types to search (default:
["youtube", "file", "torrent"]
)queue_results (bool) – Append the results to the current playing queue (default: False)
autoplay (bool) – Play the first result of the search (default: False)
search_timeout (float) – Search timeout (default: 60 seconds)
- seek(position)[source]
Seek backward/forward by the specified number of seconds
- Parameters:
position (int) – Number of seconds relative to the current cursor
- set_position(position)[source]
Seek backward/forward to the specified absolute position (same as
seek
)
- set_volume(volume)[source]
Set the volume
- Parameters:
volume (float) – Volume value between 0 and 100
- start_streaming(media, subtitles=None, download=False)
Starts streaming local media over the specified HTTP port. The stream will be available to HTTP clients on http://{this-ip}:{http_backend_port}/media/<media_id>
- Parameters:
- Returns:
dict containing the streaming URL.Example:
{ "id": "0123456abcdef.mp4", "source": "file:///mnt/media/movies/movie.mp4", "mime_type": "video/mp4", "url": "http://192.168.1.2:8008/media/0123456abcdef.mp4" }