sublime_music.players.chromecast module

class sublime_music.players.chromecast.ChromecastPlayer(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 = False
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.

chromecast_discovered_callback(chromecast)[source]
Parameters

chromecast (Any) –

property enabled: bool
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 = 'Chromecast'
new_cast_status(status)[source]
Parameters

status (Any) –

new_media_status(status)[source]
Parameters

status (Any) –

next_media_cached(*_)[source]
Parameters
  • uri – 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 – the actual song.

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.

property supported_schemes: Set[str]
Returns

a set of all the schemes that the player can play.

time_increment_order_token = 0