-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version v0.9.0 #57
Merged
Merged
Version v0.9.0 #57
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Create discrete HeosMusicSource type * Add ability to browse and treverse media * Add BrowseResult class * Remove InputSource in favor of MediaItem * Update get_favorites to use MediaItem * Update get_playlists to return MediaContainer * Remove HeosSource * Fix test typing * Collapse media types * Update wrapper methods to use same base * Add const.RepeatType and remove discrete constants * Add const.ATTR_SHUFFLE * MediaMusicSource tests * Remainder of Media module tests * Move coverage config to project file * Use const.VALUE_ON * Use const.VALUE_OFF * Use const.ATTR_TYPE * More const usage and refactoring * Add tests for uncovered code browse code
* Add const.AddCriteriaType * Add and standardize play methods * media.play_media tests * Move reused data to fixture * Refactor browse commands * Tests for play functions * Some test clean-up * Fix typing issues
* Add command decorator * Define more consts * Remove asyncio mark * Cache fixture loads * Update group tests * Return unknown command from mock device * Add calls_commands decorator and simplify group tests * Move items to common * Clean-up player tests * Update browse tests * Update heos tests * Simplify event writing * Simplified matching classes * Correct test names * Add command under process support
* Add browse mixin * Player commands 4.2.1 - 4.2.14 * Remaining player commands * Remove player commands reference * Add PlayState enum * Add test case for uncovered
Before this change, if I request to play the URL http://192.168.0.10/test.mp3?auth%3Dsomething through Home Assistant, it will result in this message being sent: heos://browse/play_stream?sequence=498&pid=-646915758&url=http://192.168.0.10/test.mp3?auth%3Dsomething but despite saying in CLI specification that special characters in arguments need to be encoded, HEOS seems to take the url argument and pass it to the stream server verbatim, as demonstrated by the nginx log resulting from this command: Jan 04 12:03:27 lillia nginx[351316]: lillia nginx: 192.168.0.209 - - [04/Jan/2025:12:03:27 +0100] "GET /test.mp3?auth%3Dsomething HTTP/1.1" 404 146 "-" "AvegaMediaServer/2.0 Linux/2.6" I've been playing URLs with ? in them for some months now by inserting them into the HEOS command without quoting them, for example: heos://browse/play_stream?sequence=498&pid=-646915758&url=http://192.168.0.10/test.mp3?auth=something This seems to be consistent with the requirement that url be the last argument, because then the controller can treat the rest of the command as URL without processing it. This change introduces special handling of the url argument, so that it bypasses quoting in addition to being the last argument.
* Refactored group commands * Move command consts * Move other specific consts * HeosGroup is now a dataclass * Move methods to mixins * Refactoring * Add tests * Consistency in media class implementation * HeosPlayer dataclass * Make sure player availability is set based on connection
* Allow controls for TIDAL Connect HEOS U34 added support for TIDAL Connect. When playing, the source id is always `0`. All normal player controls are supported in this case. * Merge conflic fixes * Fix const --------- Co-authored-by: Andrew Sayre <6730289+andrewsayre@users.noreply.github.com>
* Add python 3.13 and update deps * Try UV * Try UV * Remove flag * Try system * Update publish action
* Add input/source1 - 18 * Add refresh option to get_music_sources * Update readme * Typo
* Raise event when command auth error occurs * Test for command error event * Use helper * Tests and ensure dispatcher logs failed calls * Test for dispatcher exception logging * Undo change to Heos.disconnect
* Wait on dispatch calls * Add Heos callbacks * Move type defs to top * Add add_on_player_event * Add add_on_controller_event * Made heos public * Refactoring
This reverts commit 74305a5.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Fixed
url
is no longer quoted inplay_url
New
General
const
module:MediaType
added to represent media types.RepeatType
added to represent repeat options.AddCriteriaType
added to represent queue add criteria.PlayState
added to represent play state.MUSIC_SOURCE_CONNCECT
for Tidal/Sonos connectINPUT_SOURCE_1
throughINPUT_SOURCE_18
media
module:Media
represents a common base-type for music sources and media items.MediaMusicSource
represents a root-level music source, returned fromHeos.get_music_sources
and includes functionbrowse
to enumerate child items.MediaItem
represents non-root sources, and all other media types (containers, playlists, albums, stations, etc...). Functionbrowse
is used to enumerate child items whenbrowsable=True
BrowseResult
represents the result of a browse operation and includes the items returned as well as record count information.Heos
class:update_credential
parameter tosign_in
andsign_out
to indicate that the set credential should be updated and used on a reconnect attempt. Defaults toTrue
.current_credentials
property exposes the currently stored credentials, whether passed in through options, or updated as the result of a sign_in or sign_out call.browse
for browsing media item by identifiers.browse_media
for browsing aMediaMusicSource
orMediaItem
.play_media
for playing an instance ofMediaItem
. This function will call the correct underlying function to switch the input, play the stream, or add the item to the queue.play_input_source
to play an specific input source.play_station
to play a stationplay_preset_station
to play a favoriteplay_url
to play a URLadd_to_queue
to add an item to the queuereboot
to reboot the connected device.add_on_controller_event
,add_on_heos_event
,add_on_connected
,add_on_disconnected
,add_on_user_credentials_invalid
for connecting event handlers.MediaItem
class:play_media
for playing the current item on a player. This function will call the correct underlying function to switch the input, play the stream, or add the item to the queue.HeosPlayer
class:add_to_queue
to add an item to the player queueplay_media
for playing an instance ofMediaItem
. This function will call the correct underlying function to switch the input, play the stream, or add the item to the queue.add_on_player_event
for connecting event handlersBreaking changes
The following items were changed or removed in the library and may represent a breaking change, depending on usage.
const
module:SOURCE_CONTROLS
now uses enum values fromconst.MediaType
instead of discrete music source constants.TYPE_MUSIC_SERVICE
,TYPE_STATION
,TYPE_SONG
,TYPE_HEOS_SERVICE
,TYPE_PLAYLIST
. Useconst.MediaType
instead.REPEAT_ON_ALL
,REPEAT_ON_ONE
,REPEAT_OFF
,VALID_REPEAT_MODES
. Useconst.RepeatType
instead.ADD_QUEUE_PLAY_NOW
,ADD_QUEUE_PLAY_NEXT
,ADD_QUEUE_ADD_TO_END
,ADD_QUEUE_REPLACE_AND_PLAY
, andVALID_ADD_QUEUE_OPTIONS
. Use the new enumAddCriteriaType
.PLAY_STATE_PLAY
,PLAY_STATE_PAUSE
,PLAY_STATE_STOP
, andVALID_PLAY_STATES
. Use the new enumPlayState
.Heos
class:get_music_sources
now returnsdict[int, MediaMusicSource]
get_input_sources
now returnsSequence[MediaItem]
get_favorites
now returnsdict[int, MediaItem]
get_playlists
now returnsSequence[MediaItem]
music_sources
now returnsdict[int, MediaMusicSource]
HeosPlayer
class:set_play_mode
method parameterrepeat
is now of typeconst.RepeatType
play_input_source
method parameterinput_source
is now of typeMediaItem
add_to_queue
method parametersource
renamed tomedia: MediaItem
repeat
property is now of typeconst.RepeatType
play_input
toplay_input_source
for consistency.play_favorite
toplay_preset_station
for consistency.source
module:This entire module has been removed. The functionality has been replaced by the
media
module. In most cases, this represents a change to the class only -- property name and functions remain the same from their former counterparts.HeosSource
. Root level music sources are now represented byMediaMusicSource
. All other source and media types are now represented byMediaItem
InputSource
. Now represented byMediaItem
.Checklist:
.coveragerc
permitted.README.MD
updated (if necessary)