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
on_track_end (Callable[[], None]) –
on_player_event (Callable[[sublime_music.players.base.PlayerEvent], None]) –
player_device_change_callback (Callable[[sublime_music.players.base.PlayerDeviceEvent], None]) –
- __init__(on_timepos_change, on_track_end, on_player_event, player_device_change_callback, config)[source]
Initialize the player.
- Parameters
config (Dict[str, Union[str, int, bool]]) – A dictionary of configuration key -> configuration value.
on_track_end (Callable[[], None]) –
on_player_event (Callable[[sublime_music.players.base.PlayerEvent], None]) –
player_device_change_callback (Callable[[sublime_music.players.base.PlayerDeviceEvent], None]) –
- 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).
- enabled = True
- name = 'Local Playback'
- next_media_cached(uri, song)[source]
- Parameters
uri (str) – the URI to prepare to play. The URI is guaranteed to be one of the schemes in the
supported_schemes
set for this adapter.song (sublime_music.adapters.api_objects.Song) – the actual song.
- play_media(uri, progress, song)[source]
- Parameters
uri (str) – the URI to play. The URI is guaranteed to be one of the schemes in the
supported_schemes
set for this adapter.progress (datetime.timedelta) – the time at which to start playing the song.
song (sublime_music.adapters.api_objects.Song) – the actual song. This could be used to set metadata and such on the player.
- 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.
- 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]
- song_loaded = False
- supported_schemes = {'file', 'http', 'https'}