]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: distinguish the disabled channels/tags by {}, fixes #2635
authorJaroslav Kysela <perex@perex.cz>
Fri, 23 Jan 2015 13:30:28 +0000 (14:30 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 23 Jan 2015 13:30:28 +0000 (14:30 +0100)
src/api/api_channel.c

index baeb21bd68804914440dc3b428388c117fdd0955..ef9356132a6975f39d405cd29290e634ef254934 100644 (file)
@@ -49,12 +49,18 @@ api_channel_list
   channel_t *ch;
   htsmsg_t *l;
   int cfg = api_channel_is_all(perm, args);
+  char buf[128];
 
   l = htsmsg_create_list();
   pthread_mutex_lock(&global_lock);
   CHANNEL_FOREACH(ch) {
     if (!cfg && !channel_access(ch, perm, 0)) continue;
-    api_channel_key_val(l, idnode_uuid_as_str(&ch->ch_id), channel_get_name(ch));
+    if (!ch->ch_enabled) {
+      snprintf(buf, sizeof(buf), "{%s}", channel_get_name(ch));
+      api_channel_key_val(l, idnode_uuid_as_str(&ch->ch_id), buf);
+    } else {
+      api_channel_key_val(l, idnode_uuid_as_str(&ch->ch_id), channel_get_name(ch));
+    }
   }
   pthread_mutex_unlock(&global_lock);
   *resp = htsmsg_create_map();
@@ -101,11 +107,18 @@ api_channel_tag_list
   channel_tag_t *ct;
   htsmsg_t *l;
   int cfg = api_channel_is_all(perm, args);
+  char buf[128];
 
   l = htsmsg_create_list();
   TAILQ_FOREACH(ct, &channel_tags, ct_link)
-    if (cfg || channel_tag_access(ct, perm, 0))
-      api_channel_key_val(l, idnode_uuid_as_str(&ct->ct_id), ct->ct_name);
+    if (cfg || channel_tag_access(ct, perm, 0)) {
+      if (ct->ct_enabled) {
+        api_channel_key_val(l, idnode_uuid_as_str(&ct->ct_id), ct->ct_name);
+      } else {
+        snprintf(buf, sizeof(buf), "{%s}", ct->ct_name);
+        api_channel_key_val(l, idnode_uuid_as_str(&ct->ct_id), buf);
+      }
+    }
   *resp = htsmsg_create_map();
   htsmsg_add_msg(*resp, "entries", l);
   return 0;