Mercurial > code > home > repos > light9
comparison bin/effecteval @ 1933:c81f86f3d65a
effecteval is mostly obsolete, but now it can at least show a list of effects used in a song (which seq can too)
Ignore-this: c24e4c1c3ccd839e79b1b2fb19ee996a
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 02 Jun 2019 11:37:14 +0000 |
parents | 1a7e5b07bf17 |
children | f29e26811206 |
comparison
equal
deleted
inserted
replaced
1932:4dd977d11dca | 1933:c81f86f3d65a |
---|---|
5 from twisted.internet.defer import inlineCallbacks, returnValue | 5 from twisted.internet.defer import inlineCallbacks, returnValue |
6 import cyclone.web, cyclone.websocket, cyclone.httpclient | 6 import cyclone.web, cyclone.websocket, cyclone.httpclient |
7 import sys, optparse, logging, json, itertools | 7 import sys, optparse, logging, json, itertools |
8 from rdflib import URIRef, Literal | 8 from rdflib import URIRef, Literal |
9 | 9 |
10 sys.path.append('/usr/lib/pymodules/python2.7/') # for numpy, on rpi | |
11 sys.path.append('/usr/lib/python2.7/dist-packages') # For numpy | |
12 from light9 import networking, showconfig | 10 from light9 import networking, showconfig |
13 from light9.effecteval.effect import EffectNode | 11 from light9.effecteval.effect import EffectNode |
14 from light9.effect.edit import getMusicStatus, songNotePatch | 12 from light9.effect.edit import getMusicStatus, songNotePatch |
15 from light9.effecteval.effectloop import makeEffectLoop | 13 from light9.effecteval.effectloop import makeEffectLoop |
16 from greplin.scales.cyclonehandler import StatsHandler | 14 from greplin.scales.cyclonehandler import StatsHandler |
101 # todo: abort if client is gone | 99 # todo: abort if client is gone |
102 playlist = self.graph.value(showconfig.showUri(), L9['playList']) | 100 playlist = self.graph.value(showconfig.showUri(), L9['playList']) |
103 songs = list(self.graph.items(playlist)) | 101 songs = list(self.graph.items(playlist)) |
104 out = [] | 102 out = [] |
105 for s in songs: | 103 for s in songs: |
106 out.append({'uri': s, 'label': self.graph.label(s)}) | 104 out.append({'uri': s, 'label': self.graph.label(s), 'effects': []}) |
107 out[-1]['effects'] = [{ | 105 seen = set() |
108 'uri': uri, | 106 for n in self.graph.objects(s, L9['note']): |
109 'label': self.graph.label(uri) | 107 for uri in self.graph.objects(n, L9['effectClass']): |
110 } for uri in sorted(self.graph.objects(s, L9['effect']))] | 108 if uri in seen: |
109 continue | |
110 seen.add(uri) | |
111 out[-1]['effects'].append({ | |
112 'uri': uri, | |
113 'label': self.graph.label(uri) | |
114 }) | |
115 out[-1]['effects'].sort(key=lambda e: e['uri']) | |
116 | |
117 | |
111 self.sendMessage({'songs': out}) | 118 self.sendMessage({'songs': out}) |
112 | 119 |
113 | 120 |
114 class EffectUpdates(cyclone.websocket.WebSocketHandler): | 121 class EffectUpdates(cyclone.websocket.WebSocketHandler): |
115 """ | 122 """ |