mopidy / mopidy-gmusic

DEPRECATED (Mopidy extension for playing music from Google Play Music)

Home Page:https://mopidy.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deviceid Configuration

syedrali opened this issue · comments

Hi

under configuration the documentation says "If no device ID is configured, mopidy-gmusic will output a list of registered devices and their IDs." where is this outputted? This is as previously I had deviceid = mac which seemed to work fine but when run in a container gives an error that the mac address can't be obtained so I need to generate a deviceid differently.

This question from @jacobobryant in #221 is related:

Question about the deviceid config key (and the block explaining it in the README). I didn't have to specify a deviceid (I've also verified that playback works), and mopidy-gmusic didn't output a list of registered devices either (as the README says it would). Is the device id bit just out of date and should be removed?

I don't have a GMusic account, but seems like we should verify this and update the docs.

Thanks. Is there any clarification? If you want to run Mopidy in a container where the mac address cannot be obtained, then what value should be used for deviceid?

I came across this recently as well. I'm going to see if I can open a PR around this behavior, but in the meantime you can get the device ID from the Google Music Web UI.

  1. Start mopidy without any device ID specific
    • It appears to register a new device automatically when you first connect
  2. Visit https://play.google.com/music/listen#/accountsettings and scroll down to My Devices
  3. You should see something like No carrier Device
  4. Right click on that and inspect the HTML.
    • It should show you a hex value (eg, 0x12345678). Use the part after the 0x

as @syedrali said, there was no output and i wasn't sure where to find it if it did exist. using the "mac" value also failed.

i can verify @thefotios method works. i was having an issue with the device id and no matter what I tried it failed and would output errors.

this was the initial error without setting the device id value:


ERROR    2020-05-07 21:41:49,762 [44104:GMusicBackend-6] pykka
  Unhandled exception in GMusicBackend (urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx):
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pykka/_actor.py", line 186, in _actor_loop
    self.on_start()
  File "/usr/local/lib/python3.8/dist-packages/mopidy_gmusic/backend.py", line 47, in on_start
    self.session.login(
  File "/usr/local/lib/python3.8/dist-packages/mopidy_gmusic/session.py", line 68, in login
    authenticated = self.api.oauth_login(
  File "/usr/local/lib/python3.8/dist-packages/gmusicapi/clients/mobileclient.py", line 184, in oauth_login
    return self._login(session_login, device_id, locale)
  File "/usr/local/lib/python3.8/dist-packages/gmusicapi/clients/mobileclient.py", line 125, in _login
    raise OSError("a valid MAC could not be determined."
OSError: a valid MAC could not be determined. Provide an android_id (and be sure to provide the same one on future runs).
ERROR    2020-05-07 21:41:49,765 [44104:MainThread] mopidy.commands
  Actor died: GMusicBackend (urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) stopped before handling the message

then i tried using the "mac" value and it gave me the same error as above. after reading this thread and some tinkering i got a new error which was due to the initial hex prefixed at the beginning.

  Unhandled exception in GMusicBackend (urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx):
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pykka/_actor.py", line 186, in _actor_loop
    self.on_start()
  File "/usr/local/lib/python3.8/dist-packages/mopidy_gmusic/backend.py", line 47, in on_start
    self.session.login(
  File "/usr/local/lib/python3.8/dist-packages/mopidy_gmusic/session.py", line 68, in login
    authenticated = self.api.oauth_login(
  File "/usr/local/lib/python3.8/dist-packages/gmusicapi/clients/mobileclient.py", line 184, in oauth_login
    return self._login(session_login, device_id, locale)
  File "/usr/local/lib/python3.8/dist-packages/gmusicapi/clients/mobileclient.py", line 138, in _login
    self.android_id = self._validate_device_id(device_id, is_mac=is_mac)
  File "/usr/local/lib/python3.8/dist-packages/gmusicapi/clients/mobileclient.py", line 75, in _validate_device_id
    raise InvalidDeviceId('Invalid device_id %s.' % device_id, device_ids)
gmusicapi.exceptions.InvalidDeviceId: Invalid device_id 0xXXXXXXXXXXXXXXXX.Your valid device IDs are:
* xxxxxxxxxxxxxxxx
ERROR    2020-05-07 21:33:53,962 [43598:MainThread] mopidy.commands
  Actor died: GMusicBackend (urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) stopped before handling the message

once i removed the prefix from the device id, it was able to load and run.

INFO     2020-05-07 21:46:34,001 [44461:MainThread] mopidy.commands
  Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, GMusicBackend
INFO     2020-05-07 21:46:34,010 [44461:Audio-2] mopidy.audio.actor
  Audio output set to "autoaudiosink"
INFO     2020-05-07 21:46:37,224 [44461:GMusicBackend-6] mopidy_gmusic.session
  Logged in to Google Play Music
INFO     2020-05-07 21:46:37,225 [44461:MainThread] mopidy.commands

I am unfortunately facing another unrelated issue with mopidy-gmusic. i'll see if i can find a related thread first and if i do, i'll post it there. if not, then i can always new an issue and post the details there.

Closing because Google Play Music has been shut down, and this project is being discontinued.