christopher-dG / gpymusic

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

Issue with get_device_id.py #14

Closed NoahLutz closed 7 years ago

NoahLutz commented 7 years ago

First off, thanks for writing this cli for google play music. I've been looking for one for a while and haven't' been able to find a good one before I stumbled upon this repo.

Now to the issue. I tried to use the script/get_device_id.py to get a list of devices registered with my google account but when I ran the script (with proper email and app specific passwd) nothing was printed out.

I added a print statement to print out the devices object and got this as output

[{'kind': 'sj#devicemanagementinfo', 'id': 'removed', 'friendlyName': 'Google Play Music for Chrome on Windows', 'type': 'DESKTOP_APP', 'lastAccessedTimeMs': '1488256354344'}, {'kind': 'sj#devicemanagementinfo', 'id': 'removed', 'friendlyName': 'Verizon Samsung SM-N910V', 'type': 'ANDROID', 'lastAccessedTimeMs': '1488227936743'}, {'kind': 'sj#devicemanagementinfo', 'id': 'removed', 'friendlyName': 'Verizon Samsung SM-N910V', 'type': 'ANDROID', 'lastAccessedTimeMs': '1481225985805', 'smartPhone': False}]

Clearly there are registered devices so I believe there is an issue with this for loop:

for i, device in enumerate([d for d in devices if d['kind'] in (u'ANDROID', u'IOS')]):
            id = device['id']
            print('%d: %s' % (i + 1, id[2:]if id.startswith('0x') else id))
christopher-dG commented 7 years ago

Can you try the script in develop? It should be fixed there, although it's interesting that your android device didn't show up. Let me know if they're both printed in the new script.

Edit: The key 'kind' should actually be 'type' in master branch's script, that's why nothing showed up. But regardless, the one in develop branch should work better.

NoahLutz commented 7 years ago

the script in develop does work! thanks!

christopher-dG commented 7 years ago

👍 That branch will be merged in the next couple of days when I get one last thing fixed.