-
Notifications
You must be signed in to change notification settings - Fork 5
/
mkqr.py
69 lines (63 loc) · 1.39 KB
/
mkqr.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python2
import nord.g2.modules
pagemap = {
'In/Out': 0,
'Note': 1,
'Osc': 2,
'LFO': 3,
'Rnd': 4,
'Env': 5,
'Filter': 6,
'FX': 7,
'Delay': 8,
'Shaper': 9,
'Level': 10,
'Mixer': 11,
'Switch': 12,
'Logic': 13,
'Seq': 14,
'MIDI': 15,
}
pages = [ [] for p in range(16) ]
for mod in nord.g2.modules.modules:
pages[pagemap[mod.page.name]].append(mod)
def byindex(a, b):
return cmp(a.page.index, b.page.index)
for page in pages:
page.sort(byindex)
def printdata(name, items):
if len(items) == 0:
return ''
lines = []
s = '%s: ' % name
for item in items:
nm = item.name.lower()
if len(s) + 5 + len(nm) > 80:
lines.append(s)
s = ''
s += item.name.lower() + ' '
lines.append(s)
return '\n '.join(lines)
for page in pages:
print '%s:' % page[0].page.name.lower()
for mod in page:
s = ' %s: ' % mod.shortnm.lower()
ins = printdata('in', mod.inputs)
outs = printdata('out', mod.outputs)
params = printdata('params', mod.params)
strs = [ins, outs, params]
ns = ' %s ' % s.strip()
for i in range(len(strs)):
t = strs[i].strip()
if not t:
continue
if len(ns) + len(t) + 1 > 80:
ns = ns.rstrip()
if ns[-1] == ',': ns = ns[:-1]
print ns
ns = ' '
ns += t + ', '
if ns.strip() != '':
ns = ns.rstrip()
if ns[-1] == ',': ns = ns[:-1]
print ns