Changeset - c81f86f3d65a
[Not reviewed]
default
0 3 0
Drew Perttula - 6 years ago 2019-06-02 11:37:14
drewp@bigasterisk.com
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
3 files changed with 20 insertions and 13 deletions:
0 comments (0 inline, 0 general)
bin/effecteval
Show inline comments
 
@@ -4,14 +4,12 @@ from run_local import log
 
from twisted.internet import reactor
 
from twisted.internet.defer import inlineCallbacks, returnValue
 
import cyclone.web, cyclone.websocket, cyclone.httpclient
 
import sys, optparse, logging, json, itertools
 
from rdflib import URIRef, Literal
 

	
 
sys.path.append('/usr/lib/pymodules/python2.7/')  # for numpy, on rpi
 
sys.path.append('/usr/lib/python2.7/dist-packages')  # For numpy
 
from light9 import networking, showconfig
 
from light9.effecteval.effect import EffectNode
 
from light9.effect.edit import getMusicStatus, songNotePatch
 
from light9.effecteval.effectloop import makeEffectLoop
 
from greplin.scales.cyclonehandler import StatsHandler
 
from light9.namespaces import L9
 
@@ -100,17 +98,26 @@ class SongEffectsUpdates(cyclone.websock
 
    def updateClient(self):
 
        # todo: abort if client is gone
 
        playlist = self.graph.value(showconfig.showUri(), L9['playList'])
 
        songs = list(self.graph.items(playlist))
 
        out = []
 
        for s in songs:
 
            out.append({'uri': s, 'label': self.graph.label(s)})
 
            out[-1]['effects'] = [{
 
                'uri': uri,
 
                'label': self.graph.label(uri)
 
            } for uri in sorted(self.graph.objects(s, L9['effect']))]
 
            out.append({'uri': s, 'label': self.graph.label(s), 'effects': []})
 
            seen = set()
 
            for n in self.graph.objects(s, L9['note']):
 
                for uri in self.graph.objects(n, L9['effectClass']):
 
                    if uri in seen:
 
                        continue
 
                    seen.add(uri)
 
                    out[-1]['effects'].append({
 
                        'uri': uri,
 
                        'label': self.graph.label(uri)
 
                    })
 
            out[-1]['effects'].sort(key=lambda e: e['uri'])
 
                    
 
                    
 
        self.sendMessage({'songs': out})
 

	
 

	
 
class EffectUpdates(cyclone.websocket.WebSocketHandler):
 
    """
 
    stays alive for the life of the effect page
light9/effecteval/effect-components.html
Show inline comments
 
@@ -13,15 +13,16 @@
 
          <template is="dom-repeat" items="{{song.effects}}" as="effect">
 
            <li>
 
              <l9-effect uri="{{effect.uri}}"
 
                         label="{{effect.label}}"></l9-effect>
 
            </li>
 
          </template>
 
          <li>
 
            <effect-drop-target song-uri="{{song.uri}}"></effect-drop-target>
 
          </li>
 
       <!--    <li>
 
          <effect-drop-target song-uri="{{song.uri}}"></effect-drop-target>
 
      </li>
 
      -->
 
        </ul>
 
      </li>
 
    </template>
 
  </template>
 
</dom-module>
 
<script>
 
@@ -49,13 +50,13 @@
 
 });
 
</script>
 

	
 
<dom-module id="l9-effect">
 
  <template>
 
    <a class="effect" href="{{href}}">{{label}}</a>
 
    <button on-click="deleteEffect">Delete</button>
 
    
 
  </template>
 
</dom-module>
 
<script>
 
 Polymer({
 
   is: "l9-effect",
 
   properties: {
light9/effecteval/index.html
Show inline comments
 
@@ -5,13 +5,12 @@
 
    <meta charset="utf-8" />
 
    <link rel="stylesheet" href="/style.css">
 
    <link rel="import" href="effect-components.html">
 
  </head>
 
  <body>
 
    <div id="status">starting...</div>
 
    <div><a href="stats">/stats</a></div>
 
    <h1>Effect instances</h1>
 
    <h1>Effect instances <a href="stats/">[stats]</a></h1>
 
    <div><a href=".">View all songs</a></div>
 
    <!-- subscribe to a query of all effects and their songs -->
 
    <song-effect-list></song-effect-list>
 
  </body>
 
</html>
0 comments (0 inline, 0 general)