changeset 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 4dd977d11dca
children 8f58dc868dae
files bin/effecteval light9/effecteval/effect-components.html light9/effecteval/index.html
diffstat 3 files changed, 20 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/bin/effecteval	Sun Jun 02 11:36:13 2019 +0000
+++ b/bin/effecteval	Sun Jun 02 11:37:14 2019 +0000
@@ -7,8 +7,6 @@
 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
@@ -103,11 +101,20 @@
         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})
 
 
--- a/light9/effecteval/effect-components.html	Sun Jun 02 11:36:13 2019 +0000
+++ b/light9/effecteval/effect-components.html	Sun Jun 02 11:37:14 2019 +0000
@@ -16,9 +16,10 @@
                          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>
@@ -52,7 +53,7 @@
 <dom-module id="l9-effect">
   <template>
     <a class="effect" href="{{href}}">{{label}}</a>
-    <button on-click="deleteEffect">Delete</button>
+    
   </template>
 </dom-module>
 <script>
--- a/light9/effecteval/index.html	Sun Jun 02 11:36:13 2019 +0000
+++ b/light9/effecteval/index.html	Sun Jun 02 11:37:14 2019 +0000
@@ -8,8 +8,7 @@
   </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>