# HG changeset patch # User ymh # Date 1414486031 -3600 # Node ID 029cdbeebf033b5066b86b0d9daa41b7d41c11d0 # Parent 129281e4bc2a07862572a86aeb62837b0b97ee5f filter pianoroll annotation by channel & event diff -r 129281e4bc2a -r 029cdbeebf03 annot-server/static/js/pianoroll.js --- a/annot-server/static/js/pianoroll.js Tue Oct 28 11:33:52 2014 +0100 +++ b/annot-server/static/js/pianoroll.js Tue Oct 28 09:47:11 2014 +0100 @@ -13,10 +13,10 @@ var nbLines = -1; var noteHeight = 110; var noteColor = [0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, - 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, - 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, - 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, - 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, + 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, + 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, + 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, + 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991, 0xB90000, 0x4BDD71, 0xAF931E, 0x1C28BA, 0x536991]; // Vars var noteDict = []; @@ -46,12 +46,12 @@ this.container.position.x = xInit; this.container.position.y = yInit; parentContainer.addChild(this.container); - + this.linesDown = linesDown; this.height = height; this.pixelsPerSecond = pixelsPerSecond; this.width = width; - + this.addNote = function(note, startTime, duration, velocity, canal){ //console.log("coucou 1", note, timeFromZero, ts, velocity, pixelsPerSecond, container, prHeight); var beginX = (offsetMusic + startTime) * this.pixelsPerSecond / 1000; @@ -66,7 +66,7 @@ graphics.x = beginX; this.container.addChild(graphics); }; - + this.addLine = function(lineNb){ var graphics = new PIXI.Graphics(); var x = -this.container.x; @@ -89,11 +89,11 @@ t.y = this.linesDown ? this.height - 15 : 2; this.container.addChild(t); }; - + this.moveTo = function(diffTime){ this.container.x = Math.floor(diffTime*this.pixelsPerSecond); }; - + this.removePassedObjets = function(){ var nbChilds = _this.container.children.length; var i = 0, childIsNowDisplayed = false; @@ -111,7 +111,7 @@ i++; } }; - + } // Init containers @@ -201,6 +201,8 @@ } else { wsuri = "ws://" + window.location.hostname + ":8090/broadcast"; } + wsuri = wsuri + "?channel=PIANOROLL&event_code="+event_code; + if ("WebSocket" in window) { sock = new WebSocket(wsuri); } else if ("MozWebSocket" in window) { diff -r 129281e4bc2a -r 029cdbeebf03 annot-server/webapp/templates/pianoroll.html --- a/annot-server/webapp/templates/pianoroll.html Tue Oct 28 11:33:52 2014 +0100 +++ b/annot-server/webapp/templates/pianoroll.html Tue Oct 28 09:47:11 2014 +0100 @@ -1,7 +1,7 @@ - Piano Roll with pixi.js + Piano Roll {{event.label}} -

OSC websocket Piano Roll Test

+

Piano Roll {{event.label}}

@@ -25,6 +25,9 @@


     
+    
     
 
 
diff -r 129281e4bc2a -r 029cdbeebf03 annot-server/webapp/templates/pianoroll_index.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/annot-server/webapp/templates/pianoroll_index.html	Tue Oct 28 09:47:11 2014 +0100
@@ -0,0 +1,23 @@
+
+
+
+  
+  
+  Mons by IRI
+  
+  
+
+
+  
+

Évènements actifs :

+ {% for event in events %} +
+ +
+
Code : {{ event.code }}
+
Description : {{ event.description }}
+
+
+ {% endfor %} +
+ diff -r 129281e4bc2a -r 029cdbeebf03 annot-server/webapp/views.py --- a/annot-server/webapp/views.py Tue Oct 28 11:33:52 2014 +0100 +++ b/annot-server/webapp/views.py Tue Oct 28 09:47:11 2014 +0100 @@ -30,7 +30,6 @@ @app.route('/annotationclient/') def page_annotationclient_event_code(event_code): - #TODO: check event code + get event session event_query = db_session.query(models.Event).filter(models.Event.code == event_code, models.Event.active == True) event = event_query.first() @@ -58,7 +57,16 @@ @app.route('/pianoroll') def page_pianoroll(): - return render_template('pianoroll.html', logging=True) + events = db_session.query(models.Event).filter(models.Event.active == True).order_by(models.Event.start_date, models.Event.code).all() + return render_template('pianoroll_index.html', events=events) + +@app.route('/pianoroll/') +def page_pianoroll_event_code(event_code): + event = db_session.query(models.Event).filter(models.Event.code == event_code, models.Event.active == True).first() + if not event: + abort(404) + + return render_template('pianoroll.html', logging=True, event=event) diff -r 129281e4bc2a -r 029cdbeebf03 annot-server/websockets.py --- a/annot-server/websockets.py Tue Oct 28 11:33:52 2014 +0100 +++ b/annot-server/websockets.py Tue Oct 28 09:47:11 2014 +0100 @@ -62,9 +62,8 @@ def broadcast(self, msg, filter): print("broadcasting prepared message '{}' ..".format(msg)) - #preparedMsg = self.prepareMessage(msg) + preparedMsg = self.prepareMessage(msg) for c in self.clients: - preparedMsg = self.prepareMessage(msg) if all([ (k in filter and filter[k] in v) for k,v in self.filters.get(c, {}).items()]): c.sendPreparedMessage(preparedMsg) print("prepared message sent to {}".format(c.peer))