christopher-dG / gpymusic

Google Py Music: A simple TUI client for Google Play Music
MIT License
200 stars 13 forks source link

gpymusic-get-dev-id no valid MAC traceback #34

Closed mogenson closed 7 years ago

mogenson commented 7 years ago

On x86_64 Debian Stretch, Python 3.5.3. Ran setup.py install on master branch, as instructed in README.

When I run gpymusic-get-dev-id it fails with the following traceback error:

$ gpymusic-get-dev-id 
Enter your email: ********@gmail.com
Enter password for ********@gmail.com: ******** 
Traceback (most recent call last):
  File "/usr/local/bin/gpymusic-get-dev-id", line 4, in <module>
    __import__('pkg_resources').run_script('gpymusic==1.1.0', 'gpymusic-get-dev-id')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 739, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1501, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python3.5/dist-packages/gpymusic-1.1.0-py3.5.egg/EGG-INFO/scripts/gpymusic-get-dev-id", line 17, in <module>
  File "/usr/local/lib/python3.5/dist-packages/gmusicapi-10.1.2-py3.5.egg/gmusicapi/clients/mobileclient.py", line 130, 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).
christopher-dG commented 7 years ago

That's odd, I haven't seen that before. Try this:

>>> import gmusicapi
>>> mc = gmusicapi.Mobileclient()
>>> mc.login(USERNAME, PASSWORD, '')
>>> [dev['id'] for dev in mc.get_registered_devices()]
['id1', 'id2', 'etc']  # These should all work.

Hopefully that'll work.

Also please show me the output from this:

>>> mc.FROM_MAC_ADDRESS

Does the same error occur?

mogenson commented 7 years ago

Gave it a go and:

$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmusicapi
>>> mc = gmusicapi.Mobileclient()
>>> mc.login('********@gmail.com', '********', '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/gmusicapi-10.1.2-py3.5.egg/gmusicapi/clients/mobileclient.py", line 143, in login
    self.android_id = self._validate_device_id(device_id, is_mac=is_mac)
  File "/usr/local/lib/python3.5/dist-packages/gmusicapi-10.1.2-py3.5.egg/gmusicapi/clients/mobileclient.py", line 58, in _validate_device_id
    raise InvalidDeviceId('Invalid device_id %s.' % device_id, devices)
gmusicapi.exceptions.InvalidDeviceId: Invalid device_id .Your valid device IDs are:
* < 16 digit device id >
* < another 16 digit device id >
>>> 

However, I used one of the device ID's from the bottom of the python REPL and used it in gpymusic's config.json file with success. The gpymusic client can log in and play music now.

christopher-dG commented 7 years ago

Yeah it's a bit weird that you can sometimes log in without a device id and sometimes you can't. I'm glad the exception here was helpful though, it's a good thing I added that to gmusicapi :sweat_smile:

Could you also try manually logging in with the third argument being mc.FROM_MAC_ADDRESS?

mogenson commented 7 years ago
>>> mc.FROM_MAC_ADDRESS
<object object at 0x7f5f78542310>
>>> 
christopher-dG commented 7 years ago

Hm, yeah I guess there's no way for me to know ahead of time if a MAC address is going to work or not then. Thanks! Closing as this turns out to be a gmusicapi issue.