sublime_music.players package
Submodules
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
delta (sublime_music.players.base.PlayerDeviceEvent.Delta) –
player_type (Type) –
id (str) –
name (str) –
- Return type
None
- __init__(delta, player_type, id, name)
- Parameters
delta (sublime_music.players.base.PlayerDeviceEvent.Delta) –
player_type (Type) –
id (str) –
name (str) –
- Return type
None
- 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 thePlayerEvent
object.PlayerEvent.EventType.PLAY_STATE_CHANGE
– indicates that the play state of the player has changed. ThePlayerEvent.playing
property is required for this event type.PlayerEvent.EventType.VOLUME_CHANGE
– indicates that the player’s volume has changed. The :classs`PlayerEvent.volume` property is required for this event type and should be in the range [0, 100].PlayerEvent.EventType.STREAM_CACHE_PROGRESS_CHANGE
– indicates that the stream cache progress has changed. When streaming a song, this will be used to show how much of the song has been loaded into the player. ThePlayerEvent.stream_cache_duration
property is required for this event type and should be a float represent the number of seconds of the song that have been cached.PlayerEvent.EventType.CONNECTING
– indicates that a device is being connected to. ThePlayerEvent.device_id
property is required for this event type and indicates the device ID that is being connected to.PlayerEvent.EventType.CONNECTED
– indicates that a device has been connected to. ThePlayerEvent.device_id
property is required for this event type and indicates the device ID that has been connected to.
- 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)
- 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]
- available_player_types: List[Type] = [<class 'sublime_music.players.mpv.MPVPlayer'>, <class 'sublime_music.players.chromecast.ChromecastPlayer'>]
- play_media(uri, progress, song)[source]
- Parameters
uri (str) –
progress (datetime.timedelta) –
- seek(position)[source]
- Parameters
position (datetime.timedelta) –