config.chname_num = 1;
config.iptv_tpool_count = 2;
config.date_mask = strdup("");
+ config.label_formatting = 0;
idclass_register(&config_class);
.off = offsetof(config_t, date_mask),
.group = 2,
},
+ {
+ .type = PT_BOOL,
+ .id = "label_formatting",
+ .name = N_("Kodi label formatting support"),
+ .desc = N_("Enable parser for kodi label formatting"),
+ .off = offsetof(config_t, label_formatting),
+ .group = 2
+ },
{
.type = PT_STR,
.islist = 1,
uint32_t epg_update_window;
int iptv_tpool_count;
char *date_mask;
+ int label_formatting;
} config_t;
extern const idclass_t config_class;
htsmsg_add_u32(m, "chname_num", config.chname_num);
htsmsg_add_u32(m, "chname_src", config.chname_src);
htsmsg_add_str(m, "date_mask", config.date_mask);
+ htsmsg_add_u32(m, "label_formatting", config.label_formatting);
if (!access_noacl)
htsmsg_add_str(m, "username", username);
if (hc->hc_peer_ipstr)
/**
*
*/
+
+tvheadend.labelFormattingParser = function(description) {
+ if (tvheadend.label_formatting){
+ return description.replace(/\[COLOR\s(.*?)\]/g, '<font style="color:$1">')
+ .replace(/\[\/COLOR\]/g, '<\/font>')
+ .replace(/\[B\]/g, '<b>')
+ .replace(/\[\/B\]/g, '<\/b>')
+ .replace(/\[I\]/g, '<i>')
+ .replace(/\[CR\]/g, '<br>')
+ .replace(/\[\/I\]/g, '<\/i>')
+ .replace(/\[UPPERCASE\](.*)\[\/UPPERCASE\]/g, function(match, group) {return group.toUpperCase();})
+ .replace(/\[LOWERCASE\](.*)\[\/LOWERCASE\]/g, function(match, group) {return group.toLowerCase();})
+ .replace(/\[CAPITALIZE\](.*)\[\/CAPITALIZE\]/g, function(match, group) {return group.split(/\s/).map(w => w[0].toUpperCase() w.slice(1)).join(' ');});
+ }else return description;
+};
+
tvheadend.dvrDetails = function(uuid) {
function showit(d) {
if (summary && (!subtitle || subtitle != summary))
content += '<div class="x-epg-summary">' + summary + '</div>';
if (desc) {
- content += '<div class="x-epg-desc">' + desc + '</div>';
+ content += '<div class="x-epg-desc">' + tvheadend.labelFormattingParser(desc) + '</div>';
content += '<hr class="x-epg-hr"/>';
}
content += tvheadend.getDisplayCredits(credits);
if (event.summary)
content += '<div class="x-epg-summary">' + event.summary + '</div>';
if (event.description)
- content += '<div class="x-epg-desc">' + event.description + '</div>';
+ content += '<div class="x-epg-desc">' + tvheadend.labelFormattingParser(event.description) + '</div>';
if (event.summary || event.description)
content += '<hr class="x-epg-hr"/>';
content += tvheadend.getDisplayCredits(event.credits);
tvheadend.doc_history = [];
tvheadend.doc_win = null;
tvheadend.date_mask = '';
+tvheadend.label_formatting = false;
tvheadend.language = window.navigator.userLanguage || window.navigator.language;
// Use en-US if browser language detection fails.
tvheadend.chname_num = o.chname_num ? 1 : 0;
tvheadend.chname_src = o.chname_src ? 1 : 0;
tvheadend.date_mask = o.date_mask;
+ tvheadend.label_formatting = o.label_formatting ? true : false;
if (o.uilevel_nochange)
tvheadend.uilevel_nochange = true;