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