-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXT-VLCServer.js
64 lines (59 loc) · 1.55 KB
/
EXT-VLCServer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
** Module: EXT-VLCServer
** @bugsounet
** ©05-2024
** support: https://forum.bugsounet.fr
**/
Module.register("EXT-VLCServer", {
defaults: {
debug: false,
vlcPath: "/usr/bin"
},
getDom () {
var dom = document.createElement("div");
dom.style.display = "none";
return dom;
},
getTranslations () {
return {
en: "translations/en.json",
fr: "translations/fr.json"
};
},
notificationReceived (noti, payload, sender) {
switch (noti) {
case "GA_READY":
if (sender.name === "MMM-GoogleAssistant") {
this.sendSocketNotification("INIT", this.config);
this.sendNotification("EXT_HELLO", this.name);
}
break;
}
},
socketNotificationReceived (noti, payload) {
switch (noti) {
case "ERROR":
this.sendNotification("EXT_ALERT", {
type: "error",
message: this.translate(payload.message),
timer: 10000
});
console.error(`[VLC] [ERROR] ${this.translate(payload.message)}`);
break;
case "WARNING":
this.sendNotification("EXT_ALERT", {
type: "warning",
message: this.translate(payload.message, { VALUES: payload.values }),
timer: 10000
});
console.warn(`[VLC] [WARNING] ${this.translate(payload.message, { VALUES: payload.values })}`);
break;
case "STARTED":
this.sendNotification("EXT_VLCSERVER-START");
break;
case "CLOSED":
this.sendNotification("EXT_VLCSERVER-CLOSE");
break;
}
}
});