channel tags: added private flag, fixes #2501

This commit is contained in:
Jaroslav Kysela 2014-11-23 18:41:19 +01:00
parent d1bdce093d
commit fe995bda63
4 changed files with 20 additions and 5 deletions

View file

@ -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.

View 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",

View 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;

View 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 */