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

Add functionality to webostv media_player #27283

Closed
wants to merge 2 commits into from
Closed

Add functionality to webostv media_player #27283

wants to merge 2 commits into from

Conversation

poroping
Copy link

@poroping poroping commented Oct 7, 2019

Breaking Change:

Nil

Description:

Added ability to launch apps with contentId set using play_media service. Adds a line so if media_play is called and media_type is not channel then attempt to launch an app with the contentid parameter set. Previously if media_type was not channel the function just ended.

Documentation has been updated and has some examples.

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10650

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][dev-checklist]

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

@poroping
Copy link
Author

Hey all just wondering what the process is here? There is no code owner for this integration how can we get this pull approved?

Copy link
Contributor

@marchingphoenix marchingphoenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Process should be hardened to key off of the MEDIA_TYPE_APP media type and use kwargs to determine the app.
This will ensure that the behavior is explicitly handled and would avoid potential problems if something other than a channel or app is sent.

Dev automation moved this from Needs review to Review in progress Oct 22, 2019
@poroping
Copy link
Author

https://www.home-assistant.io/integrations/media_player/#service-media_playerplay_media

If guessing this is not up to date as the media_content_type can be set to 'app' successfully during my testing. However, should I be able to use kwargs in a play_media call? I get an error
extra keys not allowed @ data['kwargs']

I also tried passing media_content_type as a dict so I could split the keys into separate strings to feed into the lgtv function but it errors as it wants a string.

Worst case we can 'hardcode' the webos appid based on the media_content_id with:

if media_type == MEDIA_TYPE_APP:
    if "www.netflix.com" in media_id:
        self._client.launch_app_with_content_id("netflix", media_id)

but this makes youtube hard to integrate as the youtube app takes the youtube video ID as the media_id variable so there's nothing really to match against unless we passed the entire youtube URL and used regex to extract the video ID which is probably not something we want within the integration.

Are we happy with matching apps based on media_id string and 'falling back' on youtube app? This will result in an error in the webos youtube app due to invalid video IDs if play_media is called with media_content_type and a media_content_id that doesn't match an app and is not a valid video ID.

poroping referenced this pull request in bendavid/home-assistant Nov 1, 2019
based on new local constant media types
@poroping
Copy link
Author

poroping commented Nov 5, 2019

I just pushed another commit where I added the media_player constant URL and two local constants for netflix and youtube. I hope this is alright, I was reading through an old PR #13588 and balloob mentioned to do it this way.

I'll update the documentation shortly.

@MartinHjelmare
Copy link
Member

@bendavid can you review this PR?

@bendavid
Copy link
Contributor

bendavid commented Dec 1, 2019

The changes look technically fine, however I wonder if it would be better to just add a dedicated platform specific service in the webostv domain which maps directly onto launch_app_with_content_id.

The scaffolding for this is already implemented for generic and button commands in #29296 so this would be a straightforward addition once that one is merged...

@MartinHjelmare
Copy link
Member

Ok, I'll close here since we want a different approach.

Dev automation moved this from Review in progress to Cancelled Jan 22, 2020
@lock lock bot locked and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Cancelled
Development

Successfully merging this pull request may close these issues.

None yet

5 participants