diff --git a/package.json b/package.json index d45664e..da49d05 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,6 @@ "dependencies": { "artnet": "^1.3.2", "lowdb": "^0.16.2", - "rtpmidi": "^0.1.8", "short-id": "0.1.0-1", "socket.io": "^2.0.3", "socket.io-client": "^2.0.3" diff --git a/src/timec.ts b/src/timec.ts index ba46cff..b96f7cd 100644 --- a/src/timec.ts +++ b/src/timec.ts @@ -10,7 +10,7 @@ db.defaults({}).write(); import * as httpp from "http"; var http = httpp.createServer(); import io = require("socket.io"); -var ioClient = require("socket.io-client")("http://localhost:5000"); +var ioClient = require("socket.io-client")("192.168.1.22:5000"); var ios = io(http); const artnetp = require("artnet"); @@ -236,12 +236,18 @@ ios.on("connection", socket=>{ socket.on("set", (data)=>{ var tid = data.track; var time = new FrameTime(data.time); - var tracke = new TrackEvent(); - tracke.art = data.art; - tracke.time = time; - tracke.id = sid.generate(); - db.get(tid + ".triggers").push(tracke).write(); - socket.emit("set_finished", tracke); + if(data.id && data.id != "") { + var tracke = db.get(tid+ ".triggers").find({id:data.id}).assign({ + art:data.art, + time:time, + }).write(); + } else { + var tracke = new TrackEvent(); + tracke.art = data.art; + tracke.time = time; + tracke.id = sid.generate(); + db.get(tid + ".triggers").push(tracke).write(); + } senddata(); });