]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
channel tags: added private flag, fixes #2501
authorJaroslav Kysela <perex@perex.cz>
Sun, 23 Nov 2014 17:41:19 +0000 (18:41 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 23 Nov 2014 17:41:19 +0000 (18:41 +0100)
docs/html/config_tags.html
src/channels.c
src/channels.h
src/htsp_server.c

index 1a7e19df6709a132f1a95383dd7d05701e875f74..bb1aee7926597df3275f46d9b25bdefaa2115709 100644 (file)
       automatic recordings, groups, etc.
 
   <dt>Internal
-  <dd>Tags are exported via HTSP (to the Showtime Media player) and used
+  <dd>Tags are exported via HTSP/HTTP (to the Showtime Media player) and used
       there for grouping of TV channels. If you do not wish to export a
       tag you can flag it as internal only.
 
+  <dt>Private
+  <dd>Tags are exported via HTSP/HTTP and used there for grouping of TV
+      channels. If you do not wish to export a tag to other users (without
+      this tag in the access entry) you can flag it as private only.
+
   <dt>Icon
   <dd>Full path to an icon used to depict the tag. This can be a TV network
       logotype, etc.
index 324496f669234f9b7669a0b7a6bdbe6595a17f31..2b9dd6bb8dd63e3e6da89a451f788bef70ba6af4 100644 (file)
@@ -1060,6 +1060,9 @@ channel_tag_access(channel_tag_t *ct, access_t *a, int disabled)
   if (!disabled && (!ct->ct_enabled || ct->ct_internal))
     return 0;
 
+  if (!ct->ct_private)
+    return 1;
+
   /* Channel tag check */
   if (a->aa_chtags) {
     htsmsg_field_t *f;
@@ -1148,6 +1151,12 @@ const idclass_t channel_tag_class = {
       .name     = "Internal",
       .off      = offsetof(channel_tag_t, ct_internal),
     },
+    {
+      .type     = PT_BOOL,
+      .id       = "private",
+      .name     = "Private",
+      .off      = offsetof(channel_tag_t, ct_private),
+    },
     {
       .type     = PT_STR,
       .id       = "icon",
index 55e6ea2b519cd93fe5fa767f9903d32ebcff7b78..fcfbc99d210d061d50d09b87b423e33cd3d0792f 100644 (file)
@@ -91,6 +91,7 @@ typedef struct channel_tag {
 
   int ct_enabled;
   int ct_internal;
+  int ct_private;
   int ct_titled_icon;
   char *ct_name;
   char *ct_comment;
index e18019f598f07956724122c14e370e570f063c4c..ee426c0f0d628db90ef49defb0f1e7504d7ee1e9 100644 (file)
@@ -467,7 +467,7 @@ htsp_channel_tag_find_by_identifier(htsp_connection_t *htsp, uint32_t id)
   TAILQ_FOREACH(ct, &channel_tags, ct_link) {
     if (!channel_tag_access(ct, htsp->htsp_granted_access, 0))
       continue;
-    if (!ct->ct_internal && id == ct->ct_htsp_id)
+    if (id == ct->ct_htsp_id)
       return ct;
   }
   return NULL;
@@ -605,7 +605,7 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp)
 
   LIST_FOREACH(ctm, &ch->ch_ctms, ctm_channel_link) {
     ct = ctm->ctm_tag;
-    if(!ct->ct_internal && channel_tag_access(ct, htsp->htsp_granted_access, 0))
+    if(channel_tag_access(ct, htsp->htsp_granted_access, 0))
       htsmsg_add_u32(tags, NULL, htsp_channel_tag_get_identifier(ct));
   }
 
@@ -991,7 +991,7 @@ htsp_method_async(htsp_connection_t *htsp, htsmsg_t *in)
 
   /* Send all enabled and external tags */
   TAILQ_FOREACH(ct, &channel_tags, ct_link)
-    if(!ct->ct_internal && channel_tag_access(ct, htsp->htsp_granted_access, 0))
+    if(channel_tag_access(ct, htsp->htsp_granted_access, 0))
       htsp_send_message(htsp, htsp_build_tag(ct, "tagAdd", 0), NULL);
   
   /* Send all channels */
@@ -1001,7 +1001,7 @@ htsp_method_async(htsp_connection_t *htsp, htsmsg_t *in)
   
   /* Send all enabled and external tags (now with channel mappings) */
   TAILQ_FOREACH(ct, &channel_tags, ct_link)
-    if(!ct->ct_internal && channel_tag_access(ct, htsp->htsp_granted_access, 0))
+    if(channel_tag_access(ct, htsp->htsp_granted_access, 0))
       htsp_send_message(htsp, htsp_build_tag(ct, "tagUpdate", 1), NULL);
 
   /* Send all autorecs */