From 4f5dd9fabf8c2be10b5471dfca0e4dd30dd26dd9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:54:10 +0000 Subject: [PATCH] Implement bouquet mapping to treat services with name matching SID as unnamed Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com> --- src/bouquet.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/bouquet.c b/src/bouquet.c index 59d87f449..23ddb2c52 100644 --- a/src/bouquet.c +++ b/src/bouquet.c @@ -281,6 +281,31 @@ noname(const char *s) return 1; } +/* + * Check if service is unnamed, including when name matches service ID + */ +static int +service_is_unnamed(service_t *t) +{ + const char *name; + uint16_t sid; + char sid_str[16]; + + name = service_get_channel_name(t); + + /* Check if name is empty or whitespace-only */ + if (noname(name)) + return 1; + + /* Check if name matches service ID */ + sid = service_id16(t); + snprintf(sid_str, sizeof(sid_str), "%u", sid); + if (name && strcmp(name, sid_str) == 0) + return 1; + + return 0; +} + /* * */ @@ -307,7 +332,7 @@ bouquet_map_channel(bouquet_t *bq, service_t *t) if (!bq->bq_mapnolcn && bouquet_get_channel_number(bq, t) <= 0) return; - if (!bq->bq_mapnoname && noname(service_get_channel_name(t))) + if (!bq->bq_mapnoname && service_is_unnamed(t)) return; if (!bq->bq_mapencrypted && service_is_encrypted(t)) return; @@ -1008,7 +1033,7 @@ bouquet_class_mapopt_notify ( void *obj, const char *lang ) t = (service_t *)bq->bq_services->is_array[z]; if (!bq->bq_mapradio && service_is_radio(t)) bouquet_unmap_channel(bq, t); - else if (!bq->bq_mapnoname && noname(service_get_channel_name(t))) + else if (!bq->bq_mapnoname && service_is_unnamed(t)) bouquet_unmap_channel(bq, t); else if (!bq->bq_mapradio && service_is_radio(t)) bouquet_unmap_channel(bq, t); -- 2.47.3