Project

General

Profile

Feature #5025

Propose an enhancement to #5009 fix

Added by Steve P over 3 years ago. Updated over 3 years ago.

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:

https://tvheadend.org/projects/tvheadend/repository/revisions/222c8541b981e6db6fa9f2d59f2553235bbc1c4b

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

DVRChannelNUM.png (72.7 KB) DVRChannelNUM.png Steve P, 2018-03-24 11:11

History

#1

Updated by Steve P over 3 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....

#2

Updated by Steve P over 3 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;
 }
#3

Updated by Jaroslav Kysela over 3 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:

https://tvheadend.org/projects/tvheadend/repository/revisions/f00d5bb402ff85d608a9c638f1b70fb498973a6a

Also available in: Atom PDF