Skip to content
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

Sonos playlists play media #26054

Merged
merged 4 commits into from Aug 20, 2019

Conversation

@ahertz
Copy link
Contributor

commented Aug 18, 2019

Breaking Change:

Currently, the Sonos integration's media_player.play_media implementation ignores the media_content_type parameter. This doesn't make sense, since Sonos doesn't support most of the options (image, tvshow, video, episode or channel). This change rejects previously accepted calls using those content_types, and changes the behavior of a content_type of "playlist" to play a Sonos playlist, rather than a URL.

Description:

Currently, there is no way to play a Sonos playlist from Home Assistant. Added the ability to call media_player.play_media with a media_type of "playlist" and a media_id of the name of the playlist.

My previous pull request (to add Sonos playlists as sources) was rejected for not wanting to expand the abuse of sources any more, which I understand. This is architecturally cleaner, but slightly less user friendly (since it doesn't offer a nice UI for picking a playlist).

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@ahertz ahertz requested a review from amelchio as a code owner Aug 18, 2019

@project-bot project-bot bot added this to Needs review in Dev Aug 18, 2019

@amelchio
Copy link
Contributor

left a comment

Looks good and I think this approach should be acceptable. I added some small comments.

homeassistant/components/sonos/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/sonos/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/sonos/media_player.py Outdated Show resolved Hide resolved

Dev automation moved this from Needs review to Review in progress Aug 18, 2019

@ahertz

This comment has been minimized.

Copy link
Contributor Author

commented Aug 19, 2019

I'm not sure what's going on with the pylint check failing -- looking at the logs, it appears that setting up the test environment is failing, which I'm pretty sure has nothing to do with my code.

Looks like the failure in azure pipelines is here:

Collecting bimmer_connected==0.5.6 (from -r requirements_all.txt (line 269))  
  ERROR: Could not find a version that satisfies the requirement bimmer_connected==0.5.6 (from -r 
requirements_all.txt (line 269)) (from versions: 0.0.1, 0.0.3, 0.0.4, 0.1.0, 0.2.0, 0.3.0, 0.4.0.dev0, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.9b0, 0.5.9b1)
ERROR: No matching distribution found for bimmer_connected==0.5.6 (from -r requirements_all.txt (line 269))
##[error]Bash exited with code '1'.
Finishing: Create Virtual Environment & Install Requirements
@pvizeli

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

rebase the PR

@ahertz ahertz force-pushed the ahertz:sonos_playlists_play_media branch from 1bf9507 to bcf7539 Aug 19, 2019

@amelchio
Copy link
Contributor

left a comment

Great! 💪

Dev automation moved this from Review in progress to Reviewer approved Aug 19, 2019

@balloob balloob merged commit 7fd53ac into home-assistant:dev Aug 20, 2019

11 checks passed

CI Build #20190819.47 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 45aec2e...bcf7539
Details
codecov/project 94.02% (target 90%)
Details

Dev automation moved this from Reviewer approved to Done Aug 20, 2019

@ahertz ahertz deleted the ahertz:sonos_playlists_play_media branch Aug 20, 2019

@lock lock bot locked and limited conversation to collaborators Aug 21, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
5 participants
You can’t perform that action at this time.