--- 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) {
--- 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 @@
<html>
<head>
<meta charset="UTF-8">
- <title>Piano Roll with pixi.js</title>
+ <title>Piano Roll {{event.label}}</title>
<style>
body {
margin: 0;
@@ -16,7 +16,7 @@
</style>
</head>
<body>
- <h1>OSC websocket Piano Roll Test</h1>
+ <h1>Piano Roll {{event.label}}</h1>
<noscript>You must enable JavaScript</noscript>
<div id="canvasContainer"></div>
<p>
@@ -25,6 +25,9 @@
</p>
<pre id="log"></pre>
<script src="{{ config['STATIC_URL'] }}/js/pixi.js"></script>
+ <script>
+ var event_code = "{{event.code}}";
+ </script>
<script src="{{ config['STATIC_URL'] }}/js/pianoroll.js"></script>
</body>
</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 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>Mons by IRI</title>
+ <link rel="stylesheet" href="{{ config['STATIC_URL'] }}/css/lib.css">
+ <link rel="stylesheet" href="{{ config['STATIC_URL'] }}/css/base.css">
+</head>
+<body>
+ <div class="container" id="index-container">
+ <h1 class="row">Évènements actifs :</h1>
+ {% for event in events %}
+ <div class="row">
+ <div class="event-label"><a href="{{ url_for('page_pianoroll_event_code', event_code=event.code) }}">{{ event.label }}</a></div>
+ <dl>
+ <dt>Code : {{ event.code }}</dt>
+ <dd>Description : {{ event.description }}</dd>
+ </dl>
+ </div>
+ {% endfor %}
+ </div>
+ </body>
--- 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/<event_code>')
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/<event_code>')
+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)
--- 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))