This commit is contained in:
Reaby committed 2019-08-24 17:31:58 +03:00
1 parent 7f299fc6b8
commit 3e07d885b4
8 files changed
+147 -51

No files matched your search

+14 -1
View File
@@ -201,7 +201,7 @@ class admin {
self.updateDashboard(socket);
});
// override
// announce
socket.on('admin.override', function (data) {
try {
if (data.displayId === null) {
@@ -217,6 +217,19 @@ class admin {
cli.error("error, admin.override", err);
}
});
// announce web
socket.on('admin.overrideWebPage', function (data) {
if (data.displayId === null) {
if (data.duration == null || data.duration <= 5) {
data.duration = 45;
}
dispatcher.emit("all.override", data);
} else {
let view = self.getView();
view.overrideSlide(data.json, data.png, data.duration, data.transition);
}
});
socket.on('admin.setBundle', function (data) {
let view = self.getView();
+10 -3
View File
@@ -188,7 +188,9 @@ class display {
if (this.serverOptions.loop) {
this.clearTimers();
}
this.serverOptions.isAnnounce = false;
this.serverOptions.announceMeta = {};
let bundle = this.getBundle();
let slides = bundle.enabledSlides;
@@ -225,8 +227,10 @@ class display {
}
}
this.displayCurrentSlide();
this.serverOptions.loopIndex += 1;
if (!this.serverOptions.isStreaming) {
this.displayCurrentSlide();
this.serverOptions.loopIndex += 1;
}
}
overrideSlide(json, pngData, duration, transition) {
@@ -235,8 +239,11 @@ class display {
this.serverOptions.transition = transition;
this.serverOptions.loop = false;
this.serverOptions.isAnnounce = true;
this.serverOptions.announceMeta = json;
// save temporarily png data...
fs.writeFileSync("./tmp/display_" + this.serverOptions.displayId + ".png", pngData.replace(/^data:image\/png;base64,/, ""), "base64");
if (json.type === "image") {
fs.writeFileSync("./tmp/display_" + this.serverOptions.displayId + ".png", pngData.replace(/^data:image\/png;base64,/, ""), "base64");
}
let that = this;
if (duration && duration >= 5) {
this.serverOptions.loop = true;