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 uploader_id, uploader_name, and device_id for gmusicapi auth in gmusic plugin #3002

Merged
merged 4 commits into from
Aug 14, 2018

Conversation

michaelmob
Copy link
Contributor

@michaelmob michaelmob commented Aug 13, 2018

gmusicapi auth uses the MAC address to "register" in Google's service. Running beet gmusic-upload will fail if you use beets on multiple machines because too many MAC addresses will be registered. The fix it to be able to use the same MAC address (and device_id for searching) for all of the machines.

uploader_id (optional)

Allow custom uploader_id to not reach maximum amount of registered devices. This field should be in the format of a MAC address.
From gmusicapi method docstring: Link

There are hard limits on how many upload devices can be registered; refer to `Google's
docs <http://support.google.com/googleplay/bin/answer.py?hl=en&answer=1230356>`__. There
have been limits on deauthorizing devices in the past, so it's smart not to register
more devices than necessary.

uploader_name (optional)

May not be necessary, but perhaps in the future.
From gmusicapi method docstring: Link

This doesn't appear to be a part of authentication at all.
Registering with (id, name = X, Y) and logging in with
(id, name = X, Z) works, and does not change the server-stored
uploader_name.

device_id (optional)

When running beet gmusic-songs from a different machine (with a different MAC address) sometimes you may get this error. The device_id is generated from the MAC address.

gmusicapi.exceptions.InvalidDeviceId: Invalid device_id XXXXXXXXA351.Your valid device IDs are:
* XXXXXXXXF92F
* XXXXXXXX43A5

You can then change device_id in your config to one of the valid device IDs that gmusicapi lists for you.

config example

plugins: gmusic

gmusic:
  email: musicgoogleaccount@gmail.com
  password: seekrit
  uploader_id: XX:XX:XX:XX:f7:97
  device_id: XXXXXXXX43A5

Let me know if this is acceptable and I will write something up for the gmusic docs.

@sampsyo
Copy link
Member

sampsyo commented Aug 13, 2018

Looks cool! And it looks like you've thoroughly investigated what these parameters are for. Can you please add them to the documentation for the plugin? Feel free to leave ones that don't have an obvious use (i.e., uploader_name) undocumented for now.

@michaelmob
Copy link
Contributor Author

Okay, let me know if those additions are good.

Copy link
Member

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

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

Looks good! But I sort of like having the example first in the document—what do you think?

auto: yes
email: user@example.com
password: seekrit
**Configuration required before use.**
Copy link
Member

Choose a reason for hiding this comment

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

Hmm—I actually kind of liked having the configuration example up here, since people really will need to do this first. Any particular reason you moved it downward? Can we move it back here to stick with the logical flow of steps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You got it!

- **device_id**: Unique device ID for authorized devices.
This option only needs to be set if you receive an `InvalidDeviceId`
exception. Below the exception will be a list of valid device IDs.
Default: none.
Copy link
Member

Choose a reason for hiding this comment

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

A proper list of config options is great! Let’s definitely keep this stuff here.

@sampsyo
Copy link
Member

sampsyo commented Aug 14, 2018

Awesome. One last thing before we merge: could you please add a changelog entry to changelog.rst? Than we should be good to go!

@michaelmob
Copy link
Contributor Author

🤙

@sampsyo
Copy link
Member

sampsyo commented Aug 14, 2018

Nicely done.

@sampsyo sampsyo merged commit 86d3537 into beetbox:master Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants