Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
channel tags: added private flag, fixes #2501
  • Loading branch information
perexg committed Nov 23, 2014
1 parent d1bdce0 commit fe995bd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion docs/html/config_tags.html
Expand Up @@ -48,10 +48,15 @@
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.
Expand Down
9 changes: 9 additions & 0 deletions src/channels.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/channels.h
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/htsp_server.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}

Expand Down Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down

2 comments on commit fe995bd

@ckarrie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference btw internal and private tag?

@perexg
Copy link
Contributor Author

@perexg perexg commented on fe995bd Nov 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If channel tag is marked Private, the user must have this tag in ACL to see it (or not set == all tags permissions).. the internal flag blocks the tag for any user operations (somethink like internal to tvheadend - not sure about usage now - perhaps, we can modify the priorities using tags in future or any other channel-related parameters)...

Please sign in to comment.