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

Take in account Spotify account permissions #8012

Merged
merged 2 commits into from Jun 13, 2017

Conversation

Projects
None yet
4 participants
@Tommatheussen
Copy link
Contributor

commented Jun 12, 2017

Description:

When using a Spotify free account, the actions on the frontend all throw errors, because they are only accessible to Premium account users.
This change adds an additional scope to be used, getting the subscription type.
If this type is Premium, it will show the action buttons, otherwise nothing will be shown.

NOTE 1: I know in the docs it does say only Premium accounts can be used, but just being able to show what is played is nice imo
NOTE 2: It might be possible Spotify uses other product names as well, currently I only found open, free and premium as known types. (I'm guessing Family might be 1 as well)

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2809

Example entry for configuration.yaml (if applicable):

No changes

Checklist:

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

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

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable ([example][ex-requir]).
  • New dependencies are only imported inside functions that use them ([example][ex-import]).
  • 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:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.
if self._user is not None and self._user['product'] == 'premium':
return SUPPORT_SPOTIFY
else:
return None

This comment has been minimized.

Copy link
@houndci-bot

houndci-bot Jun 12, 2017

indentation is not a multiple of four

@@ -308,4 +310,7 @@ def media_title(self):
@property
def supported_features(self):
"""Return the media player features that are supported."""
return SUPPORT_SPOTIFY
if self._user is not None and self._user['product'] == 'premium':
return SUPPORT_SPOTIFY

This comment has been minimized.

Copy link
@houndci-bot

houndci-bot Jun 12, 2017

indentation is not a multiple of four

@pvizeli

This comment has been minimized.

Copy link
Member

commented Jun 13, 2017

I think it should be not be able to create a device if the rights are not correct and print a error. You change make it be possible to create a player without functionality...

@Tommatheussen

This comment has been minimized.

Copy link
Contributor Author

commented Jun 13, 2017

Well, it does have functionality, if with functionality you also include the possibility to check what music is playing. It's also still possible to act on any actions that happen (for example when music starts playing from your account, you could trigger an automation etc)

@pvizeli pvizeli merged commit bf2fe60 into home-assistant:dev Jun 13, 2017

4 checks passed

cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 93.562%
Details
hound No violations found. Woof!

@balloob balloob referenced this pull request Jun 16, 2017

Merged

0.47 #8055

@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017

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