cfangmeier / tuijam

A fancy TUI client for Google Play Music
MIT License
129 stars 9 forks source link

valid MAC coiuld not be determined #60

Open grimm26 opened 4 years ago

grimm26 commented 4 years ago

I got my google play music auth code but then tuijam fails with this error:

Traceback (most recent call last):
  File "/home/mark/.local/bin/tuijam", line 11, in <module>
    load_entry_point('tuijam==0.7.1', 'console_scripts', 'tuijam')()
  File "/home/mark/.local/lib/python3.7/site-packages/tuijam/app.py", line 630, in main
    app.login()
  File "/home/mark/.local/lib/python3.7/site-packages/tuijam/app.py", line 121, in login
    locale=locale.getdefaultlocale()[0])
  File "/home/mark/.local/lib/python3.7/site-packages/gmusicapi/clients/mobileclient.py", line 184, in oauth_login
    return self._login(session_login, device_id, locale)
  File "/home/mark/.local/lib/python3.7/site-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).

I'm running python 3.7.5

silentjay commented 4 years ago

I finally got tuijam installed correctly and have run into this issue as well on ubuntu 20.04. Looks like an issue with gmusicapi.

t1meshift commented 4 years ago

@grimm26 @silentjay Could you install the player from source? I have a suspicion that we should bump gmusicapi dependency.

So, if you could, please change the line gmusicapi>=12.0.0 to gmusicapi>=13.0.0 in requirements.txt and install TUIJam in venv/pipenv (you may just run setup.py, but I wouldn't recommend it as easy_install contaminates local site-packages)

silentjay commented 4 years ago

@t1meshift done, still getting the same error with gmusicapi 13.0.0 installed. Looks like an old issue which isn't going to be fixed https://github.com/simon-weber/gmusicapi/issues/655. I assume me and @grimm26 are using NICs which aren't playing ball with gmusicapi.

Any chance tuijam could have an option to manually pass the mac address or android_id to gmusicapi? https://unofficial-google-music-api.readthedocs.io/en/latest/reference/musicmanager.html#gmusicapi.clients.Musicmanager.login

cfangmeier commented 4 years ago

It should be pretty straight forward to support an optional MAC from the config file. In earlier versions, tuijam would query gmusicapi for an android id and use that, but it was simpler to just use the MAC address under the assumption that it would always work. Obviously, this is not the case. A more robust solution may look like:

  1. If supplied, try to login using a MAC specified in the config file.
  2. If 1 fails, try to determine and use the MAC as is done currently.
  3. If 2 fails, query the api for android ids. Iterate through them until finding one that works. (Optionally - store the working id in the config file)
  4. If 3 fails, give up!
silentjay commented 4 years ago

If anyone wants a hacky way to get tuijam running around this issue: change line 123 in /home/YOUR_USER/.local/lib/python3.8/site-packages/gmusicapi/clients/mobileclient.py
mac_int = getmac() to mac_int = <YOUR_MAC_AS_INTEGER>

yeah nasty, but I wasn't prepared to let a google play music browser tab to continue to steal 500mb of ram anymore.