-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
42 lines (30 loc) · 939 Bytes
/
config.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
30
31
32
33
34
35
36
37
38
39
40
41
42
import soco
import json
import sys
conf = json.loads(open("conf.json", "r").read())
accts = json.loads(open("playlists.json", "r").read())
#player = soco.discover()
i = 0
tmp = []
for p in soco.discover():
print(str(i) + ": " + p.player_name)
tmp.append(p)
inp = int(raw_input("int: "))
conf['sonos_id'] = tmp[inp].uid
player = tmp[inp]
lists = player.get_sonos_playlists() + player.get_playlists()
print(lists)
new = []
for acct in accts:
print("Which one of these playlists belongs to the callback: " + acct['name'])
i = 0
for l in lists:
print(str(i) + ": " + l.title)
#print(lists[inp].item_id)
i+=1
inp = int(raw_input("int: "))
acct['id'] = lists[inp].item_id
print(accts)
conf = open("conf.json", "w").write(json.dumps(conf, indent=4, separators=(',', ': ')))
accts = open("playlists.json", "w").write(json.dumps(accts, indent=4, separators=(',', ': ')))
print("Done")