media.mplayer
Platypush documentation
media.mplayer
- class platypush.plugins.media.mplayer.MediaMplayerPlugin(mplayer_bin=None, mplayer_timeout=0.5, args=None, *argv, **kwargs)[source]
Bases:
MediaPlugin
Plugin to control MPlayer instances
Requires:
mplayer executable on your system
- __init__(mplayer_bin=None, mplayer_timeout=0.5, args=None, *argv, **kwargs)[source]
Create the MPlayer wrapper. Note that the plugin methods are populated dynamically by introspecting the mplayer executable. You can verify the supported methods at runtime by using the list_actions method.
- Parameters:
mplayer_bin (str) – Path to the MPlayer executable (default: search for the first occurrence in your system PATH environment variable)
mplayer_timeout (float) – Timeout in seconds to wait for more data from MPlayer before considering a response ready (default: 0.5 seconds)
subtitles (str) – Path to the subtitles file
args (list) – Default arguments that will be passed to the MPlayer executable
- execute(cmd, args=None)[source]
Execute a raw MPlayer command. See https://www.mplayerhq.hu/DOCS/tech/slave.txt for a reference or call
platypush.plugins.media.mplayer.list_actions()
to get a list
- get_property(property, args=None)[source]
Get a player property (e.g. pause, fullscreen etc.). See https://www.mplayerhq.hu/DOCS/tech/slave.txt for a full list of the available properties
- 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
- Parameters:
position (int) – Number of seconds from the start
- set_property(property, value, args=None)[source]
Set a player property (e.g. pause, fullscreen etc.). See https://www.mplayerhq.hu/DOCS/tech/slave.txt for a full list of the available properties
- set_volume(volume)[source]
Set the volume
- Parameters:
volume (float) – Volume value between 0 and 100
- status()[source]
Get the current player state.
- Returns:
A dictionary containing the current state.
Example:
output = { "state": "play" # or "stop" or "pause" }
- step_property(property, value, args=None)[source]
Step a player property (e.g. volume, time_pos etc.). See https://www.mplayerhq.hu/DOCS/tech/slave.txt for a full list of the available steppable properties