sublime_music.players.mpv module

class sublime_music.players.mpv.MPVPlayer(on_timepos_change, on_track_end, on_player_event, player_device_change_callback, config)[source]

Bases: sublime_music.players.base.Player

Parameters
__init__(on_timepos_change, on_track_end, on_player_event, player_device_change_callback, config)[source]

Initialize the player.

Parameters
can_start_playing_with_no_latency = True
change_settings(config)[source]

This function is called when the player settings are changed (normally this happens when the user changes the settings in the UI).

Parameters

config (Dict[str, Union[str, int, bool]]) – A dictionary of configuration key -> configuration value.

enabled = True
property gapless_playback: bool
Returns

whether the player supports and is using gapless playback

static get_configuration_options()[source]
Returns

a dictionary of configuration key -> type of the option or tuple of options (for a dropdown menu).

Return type

Dict[str, Union[Type, Tuple[str, …]]]

get_is_muted()[source]
Returns

whether or not the player is muted.

Return type

bool

get_volume()[source]
Returns

the current volume on a scale of [0, 100]

Return type

float

name = 'Local Playback'
next_media_cached(uri, song)[source]
Parameters
pause()[source]

Pause the player.

play()[source]

Play the current media.

play_media(uri, progress, song)[source]
Parameters
property playing: bool
Returns

whether or not the player is currently playing a song.

refresh_players()[source]

This function is called when the user requests the player list to be refreshed in the UI.

This function should call the player_device_change_callback with the delta events to indicate changes to the UI. If there is no reason to refresh (for example, the MPV player), then this function can do nothing.

reset()[source]

Reset the player.

seek(position)[source]
Parameters

position (datetime.timedelta) – seek to the given position in the song.

set_current_device_id(device_id)[source]

Switch to the given device ID.

Parameters

device_id (str) –

set_muted(muted)[source]
Parameters

muted (bool) – set the player’s “muted” property to the given value.

set_volume(volume)[source]

Set the volume of the player to the given value.

Parameters

volume (float) – the value to set the volume to. Will be in the range [0, 100]

shutdown()[source]

Do any cleanup of the player.

song_loaded = False
supported_schemes = {'file', 'http', 'https'}