forked from squeezebox-googlemusic/squeezebox-googlemusic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmobile_devices.py
executable file
·29 lines (20 loc) · 897 Bytes
/
mobile_devices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
import argparse
from gmusicapi import Webclient
def main():
parser = argparse.ArgumentParser(description = 'List all devices registered for Google Play Music')
parser.add_argument('username', help = 'Your Google Play Music username')
parser.add_argument('password', help = 'Your very secret password')
args = parser.parse_args()
api = Webclient(validate = False)
if not api.login(args.username, args.password):
print "Could not login to Google Play Music. Incorrect username or password."
return
for device in api.get_registered_devices():
print '%s | %s | %s | %s' % (device['name'],
device.get('manufacturer'),
device['model'],
device['id'])
api.logout()
if __name__ == '__main__':
main()