From: edisionnano Date: Thu, 10 Jul 2025 22:54:45 +0000 (+0300) Subject: Implement age ratings on XMLTV X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e065d661aa837aef0fa93b5350afef4a2b77ed79;p=thirdparty%2Ftvheadend.git Implement age ratings on XMLTV Update xmltv.c Apply suggestion from @Copilot Test for epgdb_processparentallabels to avoid false positives Add branch in case rating_label exists but system is null Fallback to rl_display_age before rl_age Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com> --- diff --git a/src/webui/xmltv.c b/src/webui/xmltv.c index 15bd652c9..d7e260373 100644 --- a/src/webui/xmltv.c +++ b/src/webui/xmltv.c @@ -23,6 +23,7 @@ #include "http.h" #include "string_list.h" #include "imagecache.h" +#include "epggrab.h" #define XMLTV_FLAG_LCN (1<<0) @@ -184,6 +185,8 @@ http_xmltv_programme_one_long(const http_connection_t *hc, lang_str_ele_t *lse; epg_genre_t *genre; char buf[64]; + char prop_buf[512]; + const char *str; if (ebc->subtitle) RB_FOREACH(lse, ebc->subtitle, link) { @@ -222,6 +225,54 @@ http_xmltv_programme_one_long(const http_connection_t *hc, } htsbuf_append_str(hq, " \n"); } + + if (epggrab_conf.epgdb_processparentallabels && ebc->rating_label) { + const char *system = ebc->rating_label->rl_authority; + if (!system) system = ebc->rating_label->rl_country; + if (system && (ebc->rating_label->rl_display_label || ebc->rating_label->rl_display_age || ebc->rating_label->rl_age)) { + htsbuf_append_str(hq, " \n"); + if (ebc->rating_label->rl_display_label) { + htsbuf_append_str(hq, " "); + htsbuf_append_and_escape_xml(hq, ebc->rating_label->rl_display_label); + htsbuf_append_str(hq, "\n"); + } else if (ebc->rating_label->rl_display_age) { + htsbuf_append_str(hq, " "); + htsbuf_qprintf(hq, "%d", ebc->rating_label->rl_display_age); + htsbuf_append_str(hq, "\n"); + } else if (ebc->rating_label->rl_age) { + htsbuf_append_str(hq, " "); + htsbuf_qprintf(hq, "%d", ebc->rating_label->rl_age); + htsbuf_append_str(hq, "\n"); + } + if (ebc->rating_label->rl_icon) { + str = ebc->rating_label->rl_icon; + if (!strempty(str)) { + str = imagecache_get_propstr(str, prop_buf, sizeof(prop_buf)); + if (str) { + htsbuf_append_str(hq, " \n"); + } + } + } + htsbuf_append_str(hq, " \n"); + } else if (ebc->age_rating) { + htsbuf_append_str(hq, " \n"); + htsbuf_append_str(hq, " "); + htsbuf_qprintf(hq, "%d", ebc->age_rating); + htsbuf_append_str(hq, "\n"); + htsbuf_append_str(hq, " \n"); + } + } else if (ebc->age_rating) { + htsbuf_append_str(hq, " \n"); + htsbuf_append_str(hq, " "); + htsbuf_qprintf(hq, "%d", ebc->age_rating); + htsbuf_append_str(hq, "\n"); + htsbuf_append_str(hq, " \n"); + } + _http_xmltv_programme_write_string_list(hq, ebc->category, "category"); LIST_FOREACH(genre, &ebc->genre, link) { if (genre && genre->code) {