Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
htsp server: add getDvrConfigs method
  • Loading branch information
perexg committed Oct 9, 2014
1 parent 811191c commit 0b69b2d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dvr/dvr.h
Expand Up @@ -36,6 +36,7 @@ typedef struct dvr_config {
int dvr_enabled;
int dvr_valid;
char *dvr_config_name;
char *dvr_comment;
profile_t *dvr_profile;
char *dvr_storage;
uint32_t dvr_retention_days;
Expand Down
7 changes: 7 additions & 0 deletions src/dvr/dvr_config.c
Expand Up @@ -486,6 +486,13 @@ const idclass_t dvr_config_class = {
.group = 1,
.get_opts = dvr_config_class_enabled_opts,
},
{
.type = PT_STR,
.id = "comment",
.name = "Comment",
.off = offsetof(dvr_config_t, dvr_comment),
.group = 1,
},
{
.type = PT_STR,
.id = "profile",
Expand Down
28 changes: 28 additions & 0 deletions src/htsp_server.c
Expand Up @@ -1290,6 +1290,33 @@ htsp_dvr_config_name( htsp_connection_t *htsp, const char *config_name )
return cfg ? idnode_uuid_as_str(&cfg->dvr_id) : NULL;
}

/**
*
*/
static htsmsg_t *
htsp_method_getDvrConfigs(htsp_connection_t *htsp, htsmsg_t *in)
{
htsmsg_t *out, *l, *c;
dvr_config_t *cfg;

l = htsmsg_create_list();

LIST_FOREACH(cfg, &dvrconfigs, config_link)
if (cfg->dvr_enabled) {
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_msg(l, NULL, c);
}

out = htsmsg_create_map();

htsmsg_add_msg(out, "dvrconfigs", l);

return out;
}

/**
* add a Dvrentry
*/
Expand Down Expand Up @@ -2158,6 +2185,7 @@ struct {
{ "getEvents", htsp_method_getEvents, ACCESS_STREAMING},
{ "epgQuery", htsp_method_epgQuery, ACCESS_STREAMING},
{ "getEpgObject", htsp_method_getEpgObject, ACCESS_STREAMING},
{ "getDvrConfigs", htsp_method_getDvrConfigs, ACCESS_RECORDER},
{ "addDvrEntry", htsp_method_addDvrEntry, ACCESS_RECORDER},
{ "updateDvrEntry", htsp_method_updateDvrEntry, ACCESS_RECORDER},
{ "cancelDvrEntry", htsp_method_cancelDvrEntry, ACCESS_RECORDER},
Expand Down

0 comments on commit 0b69b2d

Please sign in to comment.