channel: cleanup the configuration tree
<cfg>/channel/config <cfg>/channel/tag Also use hts_settings_load() instead hts_settings_load_r() for the appropriate places..
This commit is contained in:
parent
220833201f
commit
82f7f89670
4 changed files with 35 additions and 8 deletions
|
@ -967,7 +967,7 @@ access_init(int createdefault, int noacl)
|
|||
TAILQ_INIT(&access_tickets);
|
||||
|
||||
/* Load */
|
||||
if ((c = hts_settings_load_r(1, "accesscontrol")) != NULL) {
|
||||
if ((c = hts_settings_load("accesscontrol")) != NULL) {
|
||||
HTSMSG_FOREACH(f, c) {
|
||||
if (!(m = htsmsg_field_get_map(f))) continue;
|
||||
(void)access_entry_create(f->hmf_name, m);
|
||||
|
|
|
@ -620,7 +620,7 @@ channel_delete ( channel_t *ch, int delconf )
|
|||
|
||||
/* Settings */
|
||||
if (delconf)
|
||||
hts_settings_remove("channel/%s", idnode_uuid_as_str(&ch->ch_id));
|
||||
hts_settings_remove("channel/config/%s", idnode_uuid_as_str(&ch->ch_id));
|
||||
|
||||
/* Free memory */
|
||||
RB_REMOVE(&channels, ch, ch_link);
|
||||
|
@ -638,7 +638,7 @@ channel_save ( channel_t *ch )
|
|||
{
|
||||
htsmsg_t *c = htsmsg_create_map();
|
||||
idnode_save(&ch->ch_id, c);
|
||||
hts_settings_save(c, "channel/%s", idnode_uuid_as_str(&ch->ch_id));
|
||||
hts_settings_save(c, "channel/config/%s", idnode_uuid_as_str(&ch->ch_id));
|
||||
htsmsg_destroy(c);
|
||||
}
|
||||
|
||||
|
@ -656,7 +656,7 @@ channel_init ( void )
|
|||
channel_tag_init();
|
||||
|
||||
/* Channels */
|
||||
if (!(c = hts_settings_load_r(1, "channel")))
|
||||
if (!(c = hts_settings_load("channel/config")))
|
||||
return;
|
||||
|
||||
HTSMSG_FOREACH(f, c) {
|
||||
|
@ -798,7 +798,7 @@ channel_tag_destroy(channel_tag_t *ct, int delconf)
|
|||
channel_tag_mapping_destroy(ctm, CTM_DESTROY_UPDATE_CHANNEL);
|
||||
channel_save(ch);
|
||||
}
|
||||
hts_settings_remove("channeltags/%s", idnode_uuid_as_str(&ct->ct_id));
|
||||
hts_settings_remove("channel/tag/%s", idnode_uuid_as_str(&ct->ct_id));
|
||||
}
|
||||
|
||||
if(ct->ct_enabled && !ct->ct_internal)
|
||||
|
@ -821,7 +821,7 @@ channel_tag_save(channel_tag_t *ct)
|
|||
{
|
||||
htsmsg_t *c = htsmsg_create_map();
|
||||
idnode_save(&ct->ct_id, c);
|
||||
hts_settings_save(c, "channeltags/%s", idnode_uuid_as_str(&ct->ct_id));
|
||||
hts_settings_save(c, "channel/tag/%s", idnode_uuid_as_str(&ct->ct_id));
|
||||
htsmsg_destroy(c);
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ channel_tag_init ( void )
|
|||
htsmsg_field_t *f;
|
||||
|
||||
TAILQ_INIT(&channel_tags);
|
||||
if ((c = hts_settings_load_r(1, "channeltags")) != NULL) {
|
||||
if ((c = hts_settings_load("channel/tag")) != NULL) {
|
||||
HTSMSG_FOREACH(f, c) {
|
||||
if (!(m = htsmsg_field_get_map(f))) continue;
|
||||
(void)channel_tag_create(f->hmf_name, m);
|
||||
|
|
27
src/config.c
27
src/config.c
|
@ -827,6 +827,32 @@ config_migrate_v9 ( void )
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
config_migrate_move ( const char *dir,
|
||||
const char *newdir )
|
||||
{
|
||||
htsmsg_t *c, *e;
|
||||
htsmsg_field_t *f;
|
||||
|
||||
if (!(c = hts_settings_load(dir)))
|
||||
return;
|
||||
|
||||
HTSMSG_FOREACH(f, c) {
|
||||
if (!(e = htsmsg_field_get_map(f))) continue;
|
||||
hts_settings_save(e, "%s/%s", newdir, f->hmf_name);
|
||||
hts_settings_remove("%s/%s", dir, f->hmf_name);
|
||||
}
|
||||
|
||||
htsmsg_destroy(c);
|
||||
}
|
||||
|
||||
static void
|
||||
config_migrate_v10 ( void )
|
||||
{
|
||||
config_migrate_move("channel", "channel/config");
|
||||
config_migrate_move("channeltags", "channel/tag");
|
||||
}
|
||||
|
||||
/*
|
||||
* Migration table
|
||||
*/
|
||||
|
@ -840,6 +866,7 @@ static const config_migrate_t config_migrate_table[] = {
|
|||
config_migrate_v7,
|
||||
config_migrate_v8,
|
||||
config_migrate_v9,
|
||||
config_migrate_v10,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1034,7 +1034,7 @@ esfilter_init(void)
|
|||
for (i = 0; i <= ESF_CLASS_LAST; i++)
|
||||
TAILQ_INIT(&esfilters[i]);
|
||||
|
||||
if (!(c = hts_settings_load_r(1, "esfilter")))
|
||||
if (!(c = hts_settings_load("esfilter")))
|
||||
return;
|
||||
HTSMSG_FOREACH(f, c) {
|
||||
if (!(e = htsmsg_field_get_map(f)))
|
||||
|
|
Loading…
Add table
Reference in a new issue