Skip to content

Commit

Permalink
qlc+ fixes and various usability fixes while using tablet...
Browse files Browse the repository at this point in the history
  • Loading branch information
reaby committed Mar 18, 2021
1 parent 0f1c15a commit df52b2d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
6 changes: 4 additions & 2 deletions bin/qlcplus.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class QLCplus extends EventEmitter {
return;
}
try {
this.websocket.send("QLC+API|" + command + "|" + params.join("|"));
this.websocket.send("QLC+API|" + command + "|" + params.join("|"));
console.log("QLC+API|" + command + "|" + params.join("|"));
return await eventToPromise(this, `api:${command}`);
} catch (e) {
console.log(e);
Expand All @@ -31,7 +32,8 @@ class QLCplus extends EventEmitter {
return;
}
try {
this.websocket.send("QLC+API|" + command + "|" + params.join("|"));
this.websocket.send("QLC+API|" + command + "|" + params.join("|"));
console.log("QLC+API|" + command + "|" + params.join("|"));
} catch (e) {
console.log(e);
}
Expand Down
33 changes: 30 additions & 3 deletions bin/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ class websocket {
if (config.obs.enabled) {
self.getObsStatus(client);
}


if (self.serverOptions.currentSong != "") {
client.emit("callback.loadSong", self.getSong(self.serverOptions.currentSong));
}


client.on("showTitles", data => {
self.serverOptions.showTitle = true;
Expand Down Expand Up @@ -165,6 +169,7 @@ class websocket {
if (index !== -1) {
await self.setQlcScene(index);
setTimeout(async () => {

await self.getQlcStatus();
io.emit("obs.update", self.serverOptions);
}, 200)
Expand All @@ -178,7 +183,20 @@ class websocket {
await self.getQlcStatus();
io.emit("obs.update", self.serverOptions);
}, 200)
})
});

client.on("qlc.syncScenes", async (index) => {
await self.getQlcStatus();
io.emit("obs.update", self.serverOptions);
});

client.on("qlc.clearScenes", async (index) => {
self.clearQlcScene(index);
setTimeout(async () => {
await self.getQlcStatus();
io.emit("obs.update", self.serverOptions);
}, 200)
});

client.on("newShow", () => {
self.serverOptions.currentShow = "";
Expand Down Expand Up @@ -222,11 +240,20 @@ class websocket {
});
}

clearQlcScene(index) {
for (let scene of this.serverOptions.qlc.scenes) {
this.qlc.send("setFunctionStatus", scene.id, 0);
}
}

setQlcScene(index) {
for (let scene of this.serverOptions.qlc.scenes) {
this.qlc.send("setFunctionStatus", scene.id, 0);
}
this.qlc.send("setFunctionStatus", index, 1);
setTimeout( () => {
this.qlc.send("setFunctionStatus", index, 1);
}, 100);

}

async getQlcStatus() {
Expand Down
10 changes: 6 additions & 4 deletions public/javascripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ socket.on('obs.scenelist', data => {
}
output += `
<div class="ui left aligned gray message inverted item" id=scene_${idx}">
<div class="ui content noselect">
<button class="ui small basic inverted icon button" onclick="setScene('${scene.name}', this)"><i class="play icon"></i></button> ${scene.name}
<div class="ui content noselect">
<button class="ui small basic inverted icon button" ondblclick="setScene('${scene.name}', this)"><i class="play icon"></i></button> ${scene.name}
</div>
</div>`;
idx++;
Expand Down Expand Up @@ -241,11 +241,12 @@ function updateSongs() {
let i = 0;
for (var song of serverOptions.showData.songs) {
output += `
<div class="ui left aligned gray message inverted item handle" data-song="${song.file}" >
<div class="ui left aligned gray message inverted item" data-song="${song.file}" >
<div class="right floated content noselect">
<button class="ui small basic inverted icon button" onclick="removeSong(${i})"><i class="delete icon"></i></button>
</div>
<div class="ui content noselect" onclick="loadSong('${song.file}', ${i})">
<div class="ui content noselect">
<div class="ui inverted basic icon button handle"><i class="move icon"></i></div>
<div class="ui inverted basic icon button" onclick="loadSong('${song.file}', ${i})"><i class="play icon"></i></div>
<i class="music icon"></i> ${song.title} (${song.artist})
</div>
Expand Down Expand Up @@ -274,6 +275,7 @@ function setScene(name, elem) {

function updateSong(input) {
songData = input.data;
currentSong = input.file;
let output = "";
output +=
`
Expand Down
2 changes: 2 additions & 0 deletions views/admin.twig
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
<div id="myTitles" class="ui list"></div>
</div>
<div class="ui bottom attached inverted tab segment" data-tab="fourth">
<button class="ui small button" onclick="socket.emit('qlc.syncScenes');"><i class="refresh icon"></i>Sync Scenes</class></button>
<button class="ui small button" onclick="socket.emit('qlc.clearScenes');"><i class="trash icon"></i>Reset Scenes</class></button>
<div id="lights" class="ui list"></div>
</div>
</div>
Expand Down

0 comments on commit df52b2d

Please sign in to comment.