function scriptAction(obj) {
var title = (obj.item.file_name || obj.item.title);
h.notification(“item agendado: ” + title, 5);
var id = ‘after_countdown_finish’;
h.addTriggerListener({
id: id, when: ‘change’,
item: ‘countdown_seconds_public’,
action: function(evt) {
if (parseInt(evt.new_value) > 2) {
return;
}
h.setTimeout(function() {
switch(obj.type) {
case ‘text’:
h.showText(obj.item.id);
break;
case ‘song’:
h.showSong(obj.item.id);
break;
case ‘audio’:
h.playAudio(obj.item.file_fullname);
break;
case ‘video’:
h.playVideo(obj.item.file_fullname);
break;
case ‘image’:
h.showImage(obj.item.file_fullname);
break;
}
}, 1500);
h.removeTriggerListener(id);
}
});
}