diff --git a/src/htsp_server.c b/src/htsp_server.c index 8726157b..8c615900 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -1299,16 +1299,29 @@ static htsmsg_t * htsp_method_getDvrConfigs(htsp_connection_t *htsp, htsmsg_t *in) { htsmsg_t *out, *l, *c; + htsmsg_field_t *f; dvr_config_t *cfg; + const char *uuid, *s; l = htsmsg_create_list(); LIST_FOREACH(cfg, &dvrconfigs, config_link) if (cfg->dvr_enabled) { + uuid = idnode_uuid_as_str(&cfg->dvr_id); + if (htsp->htsp_granted_access->aa_dvrcfgs) { + HTSMSG_FOREACH(f, htsp->htsp_granted_access->aa_dvrcfgs) { + if (!(s = htsmsg_field_get_str(f))) + continue; + if (strcmp(s, uuid) == 0) + break; + } + if (f == NULL) + continue; + } c = htsmsg_create_map(); htsmsg_add_str(c, "uuid", idnode_uuid_as_str(&cfg->dvr_id)); - htsmsg_add_str(c, "name", cfg->dvr_config_name); - htsmsg_add_str(c, "comment", cfg->dvr_comment); + htsmsg_add_str(c, "name", cfg->dvr_config_name ?: ""); + htsmsg_add_str(c, "comment", cfg->dvr_comment ?: ""); htsmsg_add_msg(l, NULL, c); } @@ -2163,7 +2176,7 @@ htsp_method_getProfiles(htsp_connection_t *htsp, htsmsg_t *in) htsmsg_t *out, *l; l = htsmsg_create_list(); - profile_get_htsp_list(l); + profile_get_htsp_list(l, htsp->htsp_granted_access->aa_profiles); out = htsmsg_create_map(); diff --git a/src/profile.c b/src/profile.c index 7d396569..12a820c2 100644 --- a/src/profile.c +++ b/src/profile.c @@ -395,15 +395,28 @@ profile_class_get_list(void *o) * */ void -profile_get_htsp_list(htsmsg_t *array) +profile_get_htsp_list(htsmsg_t *array, htsmsg_t *filter) { profile_t *pro; htsmsg_t *m; + htsmsg_field_t *f; + const char *uuid, *s; TAILQ_FOREACH(pro, &profiles, pro_link) { if (pro->pro_work) { + uuid = idnode_uuid_as_str(&pro->pro_id); + if (filter) { + HTSMSG_FOREACH(f, filter) { + if (!(s = htsmsg_field_get_str(f))) + continue; + if (strcmp(s, uuid) == 0) + break; + } + if (f == NULL) + continue; + } m = htsmsg_create_map(); - htsmsg_add_str(m, "uuid", idnode_uuid_as_str(&pro->pro_id)); + htsmsg_add_str(m, "uuid", uuid); htsmsg_add_str(m, "name", pro->pro_name ?: ""); htsmsg_add_str(m, "comment", pro->pro_comment ?: ""); htsmsg_add_msg(array, NULL, m); diff --git a/src/profile.h b/src/profile.h index a0e71043..c8d05583 100644 --- a/src/profile.h +++ b/src/profile.h @@ -116,7 +116,7 @@ const char *profile_get_name(profile_t *pro); static inline muxer_container_type_t profile_get_mc(profile_t *pro) { return pro->pro_get_mc(pro); } -void profile_get_htsp_list(htsmsg_t *array); +void profile_get_htsp_list(htsmsg_t *array, htsmsg_t *filter); void profile_init(void); void profile_done(void);