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 OnResume event to handle play status correctly #14403

Closed
wants to merge 3 commits into from
Closed

Add OnResume event to handle play status correctly #14403

wants to merge 3 commits into from

Conversation

quthla
Copy link
Contributor

@quthla quthla commented May 12, 2018

Description:

Related issue (if applicable): fixes #14394

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

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

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

@quthla quthla requested a review from emlove as a code owner May 12, 2018 01:16
@homeassistant
Copy link
Contributor

Hi @quthla,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@homeassistant
Copy link
Contributor

Hi @quthla,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@@ -392,7 +393,7 @@ def state(self):
if not self._players:
return STATE_IDLE

if self._properties['speed'] == 0 and not self._properties['live']:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see related issue from description

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Seems reasonable enough.

Going to ping @lwis since they added it originally: #4388

Copy link
Member

Choose a reason for hiding this comment

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

The problem with this is that the state will change if the stream buffers, so if you're watching something which keeps buffering it'll trigger whatever state change actions you have set (which for me is lights, which quickly becomes annoying)

if MEDIA_TYPES.get(self._item.get('type')) is None and self._players:
return MEDIA_TYPES.get(self._players[0]['type'])
return MEDIA_TYPES.get(self._item.get('type'))
return self._item.get('title') or self._item.get('label') or self._item.get('file')

Choose a reason for hiding this comment

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

line too long (91 > 79 characters)

@quthla
Copy link
Contributor Author

quthla commented May 18, 2018

I added another fix to the PR.

title is still present as an empty string in the response even if not set and so get() with default doesn't work.

dictionary get()
This method return a value for the given key. If key is not available, then returns default value None.

@quthla quthla closed this May 18, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kodi component not recognizing play state correctly
5 participants