From fe995bda63ff4b932ffc7816f2add1ff8c892ae2 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 23 Nov 2014 18:41:19 +0100 Subject: [PATCH] channel tags: added private flag, fixes #2501 --- docs/html/config_tags.html | 7 ++++++- src/channels.c | 9 +++++++++ src/channels.h | 1 + src/htsp_server.c | 8 ++++---- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/html/config_tags.html b/docs/html/config_tags.html index 1a7e19df..bb1aee79 100644 --- a/docs/html/config_tags.html +++ b/docs/html/config_tags.html @@ -48,10 +48,15 @@ automatic recordings, groups, etc.
Internal -
Tags are exported via HTSP (to the Showtime Media player) and used +
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. +
Private +
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. +
Icon
Full path to an icon used to depict the tag. This can be a TV network logotype, etc. diff --git a/src/channels.c b/src/channels.c index 324496f6..2b9dd6bb 100644 --- a/src/channels.c +++ b/src/channels.c @@ -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", diff --git a/src/channels.h b/src/channels.h index 55e6ea2b..fcfbc99d 100644 --- a/src/channels.h +++ b/src/channels.h @@ -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; diff --git a/src/htsp_server.c b/src/htsp_server.c index e18019f5..ee426c0f 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -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 */