1234567891011121314151617181920212223242526 |
- #!/usr/bin/env python3
- from gmusicapi import Mobileclient
- from os.path import join, expanduser
- import yaml
- config_file = join(expanduser('~'), '.config', 'tuijam', 'config.yaml')
- try:
- with open(config_file) as f:
- config = yaml.load(f.read())
- email = config['email']
- password = config['password']
- except Exception:
- raise ValueError('Invalid config file! Check README!')
- mc = Mobileclient()
- if not mc.login(email, password, mc.FROM_MAC_ADDRESS):
- print('Login failed, verify your email and password.')
- exit(1)
- for i, id in enumerate([
- d['id'][2:] if d['id'].startswith('0x') else d['id'].replace(':', '') # noqa
- for d in mc.get_registered_devices()
- ]):
- print('%d: %s' % (i + 1, id))
|