removing small bugs
This commit is contained in:
parent
7c3f26a9f8
commit
9a60e5ee8d
27
lib/timec.js
27
lib/timec.js
@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
//DATABASE
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
"use strict";
|
||||
const low = require("lowdb");
|
||||
var db = low("db.json");
|
||||
const sid = require("short-id");
|
||||
@ -10,7 +9,10 @@ db.defaults({}).write();
|
||||
const httpp = require("http");
|
||||
var http = httpp.createServer();
|
||||
const io = require("socket.io");
|
||||
var ioClient = require("socket.io-client")("http://localhost:5000");
|
||||
var ioClient = require("socket.io-client")("http://192.168.1.22:5000", { reconect: true });
|
||||
ioClient.on("connect", () => {
|
||||
console.log("connected");
|
||||
});
|
||||
var ios = io(http);
|
||||
const artnetp = require("artnet");
|
||||
const universe = 21;
|
||||
@ -86,8 +88,14 @@ class FrameTime {
|
||||
}
|
||||
class Timecode {
|
||||
vlcUpdate(vlc) {
|
||||
if (!vlc.is_playing) {
|
||||
this.stop();
|
||||
}
|
||||
else {
|
||||
this.startTime = new Date().getTime() - vlc.time;
|
||||
this.filePlaying = vlc.file;
|
||||
console.log("vlc_update", vlc);
|
||||
}
|
||||
}
|
||||
update(time) {
|
||||
var d = new Date().getTime() - this.startTime;
|
||||
@ -103,6 +111,7 @@ class Timecode {
|
||||
var data = {};
|
||||
data.time = new FrameTime(d);
|
||||
data.track = this.activeTrack.id;
|
||||
data.filePlaying = this.filePlaying;
|
||||
ios.emit("update", data);
|
||||
}
|
||||
loadTrack(trackid) {
|
||||
@ -122,6 +131,8 @@ class Timecode {
|
||||
this.startTime = 0;
|
||||
}
|
||||
play() {
|
||||
if (!this.activeTrack)
|
||||
return;
|
||||
if (this.filePlaying) {
|
||||
ioClient.emit("play", { file: this.filePlaying });
|
||||
ioClient.on("playing", () => {
|
||||
@ -153,6 +164,7 @@ class Track {
|
||||
}
|
||||
var timecode = new Timecode();
|
||||
ios.on("connection", socket => {
|
||||
senddata();
|
||||
function senddata() {
|
||||
ios.emit("get_data", {
|
||||
tracks: db.getState(),
|
||||
@ -191,12 +203,19 @@ ios.on("connection", socket => {
|
||||
socket.on("set", (data) => {
|
||||
var tid = data.track;
|
||||
var time = new FrameTime(data.time);
|
||||
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();
|
||||
socket.emit("set_finished", tracke);
|
||||
}
|
||||
senddata();
|
||||
});
|
||||
socket.on("get", () => {
|
||||
|
File diff suppressed because one or more lines are too long
14
src/timec.ts
14
src/timec.ts
@ -10,9 +10,11 @@ db.defaults({}).write();
|
||||
import * as httpp from "http";
|
||||
var http = httpp.createServer();
|
||||
import io = require("socket.io");
|
||||
var ioClient = require("socket.io-client")("192.168.1.22:5000");
|
||||
var ioClient = require("socket.io-client")("http://192.168.1.22:5000", {reconect:true});
|
||||
ioClient.on("connect", ()=>{
|
||||
console.log("connected");
|
||||
})
|
||||
var ios = io(http);
|
||||
|
||||
const artnetp = require("artnet");
|
||||
const universe = 21;
|
||||
var artnet = artnetp({host:"192.168.1.255"});
|
||||
@ -107,8 +109,13 @@ class Timecode {
|
||||
toTrigger:Array<TrackEvent>;
|
||||
|
||||
vlcUpdate(vlc:VlcUpdate) {
|
||||
if(!vlc.is_playing){
|
||||
this.stop();
|
||||
} else {
|
||||
this.startTime = new Date().getTime() - vlc.time;
|
||||
this.filePlaying = vlc.file;
|
||||
console.log("vlc_update", vlc);
|
||||
}
|
||||
}
|
||||
|
||||
update(time:FrameTime) {
|
||||
@ -125,6 +132,7 @@ class Timecode {
|
||||
var data:any = {};
|
||||
data.time = new FrameTime(d);
|
||||
data.track = this.activeTrack.id;
|
||||
data.filePlaying = this.filePlaying;
|
||||
ios.emit("update", data);
|
||||
}
|
||||
|
||||
@ -146,6 +154,7 @@ class Timecode {
|
||||
}
|
||||
|
||||
play() {
|
||||
if(!this.activeTrack)return;
|
||||
if(this.filePlaying){
|
||||
ioClient.emit("play", {file:this.filePlaying});
|
||||
ioClient.on("playing", ()=>{
|
||||
@ -197,6 +206,7 @@ interface VlcUpdate {
|
||||
|
||||
var timecode = new Timecode();
|
||||
ios.on("connection", socket=>{
|
||||
senddata();
|
||||
function senddata(){
|
||||
ios.emit("get_data", {
|
||||
tracks: db.getState(),
|
||||
|
@ -16,6 +16,8 @@
|
||||
<button onclick="startSequence()">Play</button>
|
||||
<label >Loaded: </label>
|
||||
<label id="loaded"></label>
|
||||
<label >File playing: </label>
|
||||
<label id="fplay"></label>
|
||||
</div>
|
||||
<hr>
|
||||
<div id="track_select_div">
|
||||
@ -97,6 +99,7 @@
|
||||
if(selected.id !== data.track) return; //Nur wenn abgespielter track ausgewählt
|
||||
timenow = data.time.lmilliseconds;
|
||||
$("#actualtime").html(data.time.lhours + ":" + data.time.lminutes + ":" + data.time.lseconds + ":" + data.time.lframe);
|
||||
$("#fplay").html(data.filePlaying);
|
||||
});
|
||||
|
||||
$("#track_select").on("change", function () {
|
||||
|
Loading…
Reference in New Issue
Block a user