Skip to content

Commit bd7665b

Browse files
committed
add custom sound for IMSAK
add custom sound for IMSAK
1 parent f1a4d94 commit bd7665b

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

MMM-PrayerTime.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,14 @@ Module.register("MMM-PrayerTime",{
191191
if (this.config.playAdzan.includes((this.arrTodaySchedule[indexAdzan][0]).toLowerCase())) {
192192
if (this.config.showAdzanAlert) {
193193
var occasionNameUpper = (this.arrTodaySchedule[indexAdzan][0]).toUpperCase();
194+
var alertMsg = "ALERT_ADZAN_MSG";
195+
var adzanImsak = "ADZAN";
194196
//console.log("occasionNameUpper-"+occasionNameUpper);
195-
this.sendNotification("SHOW_ALERT", {title: this.translate("ADZAN"), imageFA: 'bullhorn', message: this.translate("ALERT_ADZAN_MSG").replace("%OCCASION", this.translate(occasionNameUpper)), timer: this.config.alertTimer});
197+
if (occasionNameUpper == "IMSAK") {
198+
alertMsg = "ALERT_IMSAK_MSG";
199+
adzanImsak = "IMSAK";
200+
}
201+
this.sendNotification("SHOW_ALERT", {title: this.translate(adzanImsak).toUpperCase(), imageFA: 'bullhorn', message: this.translate(alertMsg).replace("%OCCASION", this.translate(occasionNameUpper)), timer: this.config.alertTimer});
196202
}
197203
//console.log("this.arrTodaySchedule[indexAdzan][0]).toUpperCase()-"+(this.arrTodaySchedule[indexAdzan][0]).toUpperCase());
198204
this.sendSocketNotification("PLAY_ADZAN", {occasion: (this.arrTodaySchedule[indexAdzan][0]).toUpperCase()});

node_helper.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ module.exports = NodeHelper.create({
1818
socketNotificationReceived: function(notification, payload) {
1919
console.log(this.name + " node helper received a socket notification: " + notification + " - Payload: " + payload);
2020
if (notification == "PLAY_ADZAN") {
21-
var adzanCmd = '/usr/bin/omxplayer -o hdmi modules/MMM-PrayerTime/res/' + (payload.occasion && payload.occasion=="FAJR" ? 'adzan-fajr.mp3' : 'adzan.mp3') + ' &';
21+
var adzanSound = 'adzan.mp3';
22+
if (payload.occasion) {
23+
if (payload.occasion=="FAJR") {
24+
adzanSound = 'adzan-fajr.mp3';
25+
}
26+
else if (payload.occasion=="IMSAK") {
27+
adzanSound = 'imsak.mp3';
28+
}
29+
}
30+
var adzanCmd = '/usr/bin/omxplayer -o hdmi modules/MMM-PrayerTime/res/' + adzanSound + ' &';
2231
async.parallel([
2332
async.apply(exec, adzanCmd)
2433
],

res/imsak.mp3

509 KB
Binary file not shown.

translations/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
"ADZAN": "ADHAN",
1313
"ALERT_ADZAN_MSG": "It's praying time. Let's Sholat %OCCASION!",
14+
"ALERT_IMSAK_MSG": "ATTENTION! It is %OCCASION now!",
1415

1516
"TODAY": "Today",
1617
"TOMORROW": "Tomorrow",

translations/id.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
"ADZAN": "ADZAN",
1313
"ALERT_ADZAN_MSG": "Mari kita sholat %OCCASION!",
14+
"ALERT_IMSAK_MSG": "PERHATIAN! Sudah %OCCASION lho!",
1415

1516
"TODAY": "Hari Ini",
1617
"TOMORROW": "Besok",

0 commit comments

Comments
 (0)