Feature #5025
Propose an enhancement to #5009 fix
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-03-24
Due date:
% Done:
0%
Estimated time:
Description
Hi,
Very useful addition for me in fix for #5009:
But the format is very unreadable in my circumstances, can I propose the following change to format thus:
Channel Name (num) - See attached image
diff --git a/src/channels.c b/src/channels.c index 9cf5ad4..e2d3bea 100644 --- a/src/channels.c +++ b/src/channels.c @@ -833,26 +833,27 @@ channel_get_ename const char *s; dst[0] = '\0'; + s = channel_get_name(ch, blank); + if (s) + tvh_strlcatf(dst, dstlen, l, "%s", s); + if (flags & CHANNEL_ENAME_SOURCES) { + s = channel_get_source(ch, buf, sizeof(buf)); + if (s) + tvh_strlcatf(dst, dstlen, l, "[%s]", s); + } if (flags & CHANNEL_ENAME_NUMBERS) { number = channel_get_number(ch); if (number > 0) { if (number % CHANNEL_SPLIT) { - tvh_strlcatf(dst, dstlen, l, "%u.%u", + tvh_strlcatf(dst, dstlen, l, "%s(%u.%u)", + l > 0 ? " " : "", channel_get_major(number), channel_get_minor(number)); } else { - tvh_strlcatf(dst, dstlen, l, "%u", channel_get_major(number)); + tvh_strlcatf(dst, dstlen, l, "%s(%u)", l > 0 ? " " : "", channel_get_major(number)); } } } - s = channel_get_name(ch, blank); - if (s) - tvh_strlcatf(dst, dstlen, l, "%s%s", l > 0 ? " " : "", s); - if (flags & CHANNEL_ENAME_SOURCES) { - s = channel_get_source(ch, buf, sizeof(buf)); - if (s) - tvh_strlcatf(dst, dstlen, l, "%s[%s]", l > 0 ? " " : "", s); - } return dst; }
Files
History
Updated by Steve P over 6 years ago
This is within channel_get_ename which is only called (twice) from within api_channel_list
I can't see any knock on effects from the change, but not certain on the whole API calls....
Updated by Steve P over 6 years ago
Apologies I missed the check in spacing for CHANNEL_ENAME_SOURCES in the first attempt.
diff --git a/src/channels.c b/src/channels.c index 9cf5ad4..bb77092 100644 --- a/src/channels.c +++ b/src/channels.c @@ -833,26 +833,27 @@ channel_get_ename const char *s; dst[0] = '\0'; + s = channel_get_name(ch, blank); + if (s) + tvh_strlcatf(dst, dstlen, l, "%s", s); + if (flags & CHANNEL_ENAME_SOURCES) { + s = channel_get_source(ch, buf, sizeof(buf)); + if (s) + tvh_strlcatf(dst, dstlen, l, "%s[%s]", l > 0 ? " " : "", s); + } if (flags & CHANNEL_ENAME_NUMBERS) { number = channel_get_number(ch); if (number > 0) { if (number % CHANNEL_SPLIT) { - tvh_strlcatf(dst, dstlen, l, "%u.%u", + tvh_strlcatf(dst, dstlen, l, "%s(%u.%u)", + l > 0 ? " " : "", channel_get_major(number), channel_get_minor(number)); } else { - tvh_strlcatf(dst, dstlen, l, "%u", channel_get_major(number)); + tvh_strlcatf(dst, dstlen, l, "%s(%u)", l > 0 ? " " : "", channel_get_major(number)); } } } - s = channel_get_name(ch, blank); - if (s) - tvh_strlcatf(dst, dstlen, l, "%s%s", l > 0 ? " " : "", s); - if (flags & CHANNEL_ENAME_SOURCES) { - s = channel_get_source(ch, buf, sizeof(buf)); - if (s) - tvh_strlcatf(dst, dstlen, l, "%s[%s]", l > 0 ? " " : "", s); - } return dst; }
Updated by Jaroslav Kysela over 6 years ago
The proper fix would be to specify the requested format (order) in the global config and in HTTP requests. For the reference, the original extended name code is here: