static int api_dvr_autorec_create ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp ) { htsmsg_t *conf; dvr_config_t *cfg; dvr_autorec_entry_t *dae; const char *s1; if (!(conf = htsmsg_get_map(args, "conf"))) return EINVAL; htsmsg_set_str(conf, "owner", perm->aa_username ?: ""); htsmsg_set_str(conf, "creator", perm->aa_representative ?: ""); s1 = htsmsg_get_str(conf, "config_uuid"); if (s1 == NULL) s1 = htsmsg_get_str(conf, "config_name"); pthread_mutex_lock(&global_lock); cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, s1); if (cfg) { htsmsg_set_str(conf, "config_name", idnode_uuid_as_str(&cfg->dvr_id)); dae = dvr_autorec_create(NULL, conf); if (dae) { dvr_autorec_save(dae); dvr_autorec_changed(dae, 1); } } pthread_mutex_unlock(&global_lock); return 0; }
static int api_dvr_autorec_create ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp ) { htsmsg_t *conf; dvr_autorec_entry_t *dae; if (!(conf = htsmsg_get_map(args, "conf"))) return EINVAL; if (perm->aa_username) htsmsg_set_str(conf, "owner", perm->aa_username); if (perm->aa_representative) htsmsg_set_str(conf, "creator", perm->aa_representative); pthread_mutex_lock(&global_lock); dae = dvr_autorec_create(NULL, conf); if (dae) { dvr_autorec_save(dae); dvr_autorec_changed(dae, 1); } pthread_mutex_unlock(&global_lock); return 0; }