sublime_music.players package

Module contents

class sublime_music.players.PlayerDeviceEvent(delta: sublime_music.players.base.PlayerDeviceEvent.Delta, player_type: Type, id: str, name: str)[source]

Bases: object

Parameters
Return type

None

class Delta(value)[source]

Bases: enum.Enum

An enumeration.

ADD = 0
REMOVE = 1
__init__(delta, player_type, id, name)
Parameters
Return type

None

delta: sublime_music.players.base.PlayerDeviceEvent.Delta
id: str
name: str
player_type: Type
class sublime_music.players.PlayerEvent(type, device_id, playing=None, volume=None, stream_cache_duration=None)[source]

Bases: object

Represents an event triggered by the player. This is a way to signal state changes to Sublime Music if the player can be controlled outside of Sublime Music (for example, Chromecast player).

Each player event has a PlayerEvent.EventType. Additionally, each event type has additional information in the form of additional properties on the PlayerEvent object.

Parameters
Return type

None

class EventType(value)[source]

Bases: enum.Enum

An enumeration.

CONNECTED = 4
CONNECTING = 3
DISCONNECT = 5
PLAY_STATE_CHANGE = 0
STREAM_CACHE_PROGRESS_CHANGE = 2
VOLUME_CHANGE = 1
__init__(type, device_id, playing=None, volume=None, stream_cache_duration=None)
Parameters
Return type

None

device_id: str
playing: Optional[bool] = None
stream_cache_duration: Optional[float] = None
type: sublime_music.players.base.PlayerEvent.EventType
volume: Optional[float] = None
class sublime_music.players.PlayerManager(on_timepos_change, on_track_end, on_player_event, player_device_change_callback, config)[source]

Bases: object

Parameters
__init__(on_timepos_change, on_track_end, on_player_event, player_device_change_callback, config)[source]
Parameters
available_player_types: List[Type] = [<class 'sublime_music.players.mpv.MPVPlayer'>, <class 'sublime_music.players.chromecast.ChromecastPlayer'>]
property can_start_playing_with_no_latency: bool
change_settings(config)[source]
Parameters

config (Dict[str, Dict[str, Union[Type, Tuple[str, ...]]]]) –

property current_device_id: Optional[str]
static get_configuration_options()[source]
Returns

Dictionary of the name of the player -> option configs (see sublime_music.players.base.Player.get_configuration_options for details).

Return type

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

get_is_muted()[source]
Return type

bool

get_volume()[source]
Return type

float

next_media_cached(uri, song)[source]
Parameters
pause()[source]
play_media(uri, progress, song)[source]
Parameters
property playing: bool
refresh_players()[source]
reset()[source]
seek(position)[source]
Parameters

position (datetime.timedelta) –

set_current_device_id(device_id)[source]
Parameters

device_id (str) –

set_muted(muted)[source]
Parameters

muted (bool) –

set_volume(volume)[source]
Parameters

volume (float) –

shutdown()[source]
property song_loaded: bool
property supported_schemes: Set[str]
toggle_play()[source]