pytheos.controllers Package¶
pytheos.controllers.containers Module¶
-
pytheos.controllers.containers.create_media_leaf(item, parent, pytheos_obj)¶ Returns a leaf for our tree with a type appropriate for the response.
- Parameters
item –
parent –
pytheos_obj –
- Returns
-
class
pytheos.controllers.containers.MediaContainer(*args, **kwds)¶ Bases:
collections.abc.Sequence,typing.Generic-
property
id¶
-
property
source_id¶
-
property
name¶
-
property
nocache¶
-
property
is_container_type¶
-
property
parent¶
-
refresh(force: bool = False)¶ Refreshes the container if it is uninitialized, this call is forced, or if caching is disabled.
- Parameters
force – Force refresh
- Returns
None
-
property
-
class
pytheos.controllers.containers.MediaItem(pytheos: Pytheos, media: pytheos.models.media.MediaItem, parent: Optional[Union[models.Source, MediaContainer]])¶ Bases:
object-
property
name¶
-
property
id¶
-
property
is_container_type¶
-
property
queue_id¶
-
property
parent¶
-
property
pytheos.controllers.group Module¶
-
class
pytheos.controllers.group.Group(pytheos: Pytheos, group: pytheos.models.group.Group)¶ Bases:
objectHigh-level Group Representation
-
property
id¶
-
property
members¶
-
async
refresh(force=False)¶ Refreshes the group information if leader is unset or force is specified.
- Parameters
force – Force refresh
- Returns
None
-
async
add_member(player: controllers.Player)¶ Adds a new member to the group.
- Parameters
player – Player
- Returns
None
-
async
remove_member(player: controllers.Player)¶ Remove a member from a group.
- Parameters
player – Player
- Returns
None
-
async
get_leader() → controllers.Player¶
-
async
set_leader(value: controllers.Player)¶
-
async
get_muted() → bool¶
-
async
set_muted(value: bool)¶
-
async
get_volume() → int¶
-
async
set_volume(value: int)¶
-
property
pytheos.controllers.player Module¶
High level abstraction of a HEOS Player
-
class
pytheos.controllers.player.Player(pytheos: Pytheos, player: pytheos.models.player.Player)¶ Bases:
objectHigh-level Player API
-
property
id¶
-
property
name¶
-
property
model¶
-
property
version¶
-
property
network¶
-
property
ip¶
-
property
line_out¶
-
property
control¶
-
property
serial¶
-
property
queue¶
-
async
refresh(player_id=None)¶ Retrieve and update the Player information used by this class. Optionally, the ID already present on the instance may be overridden.
- Parameters
player_id – Player ID to use or None to use the currently set ID
- Returns
None
-
async
play_input(input_source: pytheos.models.source.InputSource, source_player: Optional[pytheos.models.player.Player] = None)¶ Instructs the player to play the specified input source. Optionally, this input source can live on another Player on the network, which can be specified with the source_player parameter.
- Parameters
input_source – Input source to play
source_player – Optional source Player ID
- Returns
None
-
async
play_favorite(favorite: int)¶ Instructs the player to play the specified favorite or preset ID.
- Parameters
favorite – Favorite/Preset ID
- Returns
None
-
async
play_quickselect(quick_select: int)¶ Instructs the player to play the specified quickselect ID. This functionality is not available on all players.
- Parameters
quick_select – Quickselect ID
- Returns
None
-
async
play_url(url: str)¶ Instructs the player to play the specified URL.
- Parameters
url – URL
- Returns
None
-
play()¶ Set the current player state to Playing.
- Returns
None
-
resume()¶ Set the current player state to Playing.
- Returns
None
-
pause()¶ Set the current player state to Paused.
- Returns
None
-
stop()¶ Set the current player state to Stopped.
- Returns
None
-
async
next()¶ Instructs the player to play the next track.
- Returns
None
-
async
previous()¶ Instructs the player to play the previous track.
- Returns
None
-
async
is_update_available() → bool¶ Determines if an update is available
- Returns
bool
-
async
get_mute() → bool¶ Determines if the player is muted
- Returns
bool
-
async
set_mute(value: bool)¶ Sets the current mute status
- Parameters
value – True or False
- Returns
None
-
async
get_repeat() → pytheos.models.player.RepeatMode¶ Retrieves the current repeat mode setting
- Returns
Repeat mode
-
async
set_repeat(value: pytheos.models.player.RepeatMode)¶ Sets the current repeat mode setting
- Parameters
value – New repeat mode value
- Returns
None
-
async
get_shuffle() → pytheos.models.player.ShuffleMode¶ Gets the current shuffle mode setting
- Returns
Shuffle mode
-
async
set_shuffle(value: pytheos.models.player.ShuffleMode)¶ Sets the current shuffle mode setting
- Parameters
value – New shuffle mode value
- Returns
None
-
async
is_playing() → bool¶ Retrieves the current playing status
- Returns
bool
-
async
set_playing(value: bool)¶ Sets the current playing status
- Parameters
value – New value
- Returns
None
-
async
get_paused() → bool¶ Retrieves the current paused status
- Returns
bool
-
async
set_paused(value: bool)¶ Sets the current paused status
- Parameters
value – New value
- Returns
None
-
async
get_stopped() → bool¶ Gets the current stopped status
- Returns
bool
-
async
set_stopped(value: bool)¶ Sets the current stop status
- Parameters
value – New value
- Returns
None
-
async
get_volume() → int¶ Retrieves the current volume value
- Returns
int
-
async
set_volume(value: int)¶ Sets the volume value. The value is constrained to the player’s minimum and maximum.
- Parameters
value – New value
- Returns
None
-
async
get_now_playing() → pytheos.models.media.MediaItem¶ Retrieves the currently playing media
- Returns
Current media item
-
async
get_play_state() → pytheos.models.player.PlayState¶ Retrieves the current play state
- Returns
Current play state
-
async
get_quick_selects() → dict¶ Retrieves a dictionary of all quick select entries
- Returns
dict
-
async
get_play_mode() → tuple¶ Retries and returns the current play mode, which includes the Repeat & Shuffle status.
- Returns
tuple
-
async
get_group() → pytheos.controllers.group.Group¶
-
property
pytheos.controllers.queue Module¶
-
class
pytheos.controllers.queue.Queue(pytheos: Pytheos, player: models.Player)¶ Bases:
objectHigh-level Queue Representation
-
async
append(obj: pytheos.models.source.Source)¶ Inserts a MediaItem at the end of the queue.
- Parameters
obj – MediaItem
- Returns
None
-
async
prepend(obj: pytheos.models.source.Source)¶ Inserts a MediaItem at the beginning of the queue.
- Parameters
obj – MediaItem
- Returns
None
-
async
insert(index: int, obj: pytheos.models.source.Source)¶ Inserts a MediaItem into the specified location in the queue.
- Parameters
index – Index
obj – MediaItem
- Returns
None
-
async
replace(index: int, obj: pytheos.models.source.Source)¶ Replaces an existing index with a new track.
- Parameters
index – Index
obj – Source item
- Returns
None
-
async
delete(index)¶
-
async
play(play_id: Optional[int] = None)¶ Starts playing the queue. Optionally takes a queue ID to play.
- Parameters
play_id – Queue ID
- Returns
None
-
async
next()¶ Plays the next track in the queue.
- Returns
None
-
async
previous()¶ Plays the previous track in the queue.
- Returns
None
-
async
stop()¶ Stops the current player.
- Returns
-
async
resume()¶ Resumes the current player.
- Returns
None
-
async
save(name: str)¶ Saves the queue to the playlists with the specified name.
- Parameters
name – Playlist name
- Returns
None
-
async
clear()¶ Clears the queue.
- Returns
None
-
async
refresh()¶ Refreshes the queue.
- Returns
None
-
async
pytheos.controllers.source Module¶
-
class
pytheos.controllers.source.Source(pytheos: Pytheos, source: pytheos.models.source.Source, parent: Optional[Union[Source, MediaContainer]] = None)¶ Bases:
collections.abc.Sequence-
property
id¶
-
property
available¶
-
property
name¶
-
property
type¶
-
property
image_url¶
-
property
service_username¶
-
property
nocache¶
-
property
source_id¶
-
property
parent¶
-
async
retrieve_metadata()¶ Retrieves a list of metadata for the specified source. Only supported on some sources.
- Returns
list
-
async
refresh(force: bool = False)¶ Refreshes the container if it is uninitialized, this call is forced, or if caching is disabled.
- Parameters
force – Force refresh
- Returns
None
-
property