TAILQ_INSERT_TAIL(&all_channel_groups, tcg, tcg_global_link);
- if(!dontwritesettings)
- channel_settings_write();
+ channel_settings_write();
return tcg;
}
ch->ch_group = tcg;
TAILQ_INSERT_SORTED(&tcg->tcg_channels, ch, ch_group_link, channelcmp);
- if(!dontwritesettings)
- channel_settings_write();
+ channel_settings_write();
}
/**
FILE *fp;
th_channel_group_t *tcg;
th_channel_t *ch;
+ th_transport_t *t;
- if(settingsfile == NULL)
+ if(dontwritesettings || startupcounter > 0 || settingsfile == NULL)
return;
fp = fopen(settingsfile, "w+");
fprintf(fp, "channel-group {\n"
"\tname = %s\n", tcg->tcg_name);
TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) {
+ if(LIST_FIRST(&ch->ch_transports) == NULL)
+ continue;
+
fprintf(fp, "\tchannel {\n"
"\t\tname = %s\n", ch->ch_name);
if(ch->ch_teletext_rundown)
}
fprintf(fp, "}\n");
}
+
+ LIST_FOREACH(t, &all_transports, tht_global_link) {
+ if(t->tht_channel == NULL)
+ continue;
+
+ fprintf(fp, "transport {\n"
+ "\tuniquename = %s\n"
+ "\tchannel = %s\n"
+ "\tprio = %d\n"
+ "}\n",
+ t->tht_uniquename,
+ t->tht_channel->ch_name,
+ t->tht_prio);
+ }
fclose(fp);
}
tcp_qprintf(&tq, "<br>");
TAILQ_FOREACH(ch, &tcg->tcg_channels, ch_group_link) {
+ if(LIST_FIRST(&ch->ch_transports) == NULL)
+ continue;
+
box_top(&tq, "box");
tcp_qprintf(&tq, "<div class=\"content3\">");
page_updatechannel(http_connection_t *hc, const char *remain, void *opaque)
{
th_channel_t *ch, *ch2;
- th_transport_t *t;
+ th_transport_t *t, **tv;
th_channel_group_t *tcg;
const char *grp, *s;
char buf[100];
- int pri;
+ int pri, i, n;
if(!html_verify_access(hc, "admin"))
return HTTP_STATUS_UNAUTHORIZED;
channel_set_group(ch, tcg);
}
- LIST_FOREACH(t, &ch->ch_transports, tht_channel_link) {
+ /* We are going to rearrange listorder by changing priority, so we
+ cannot just loop the list */
+
+ n = 0;
+ LIST_FOREACH(t, &ch->ch_transports, tht_channel_link)
+ n++;
+
+ tv = alloca(n * sizeof(th_transport_t *));
+ n = 0;
+ LIST_FOREACH(t, &ch->ch_transports, tht_channel_link)
+ tv[n++] = t;
+
+ for(i = 0; i < n; i++) {
+ t = tv[i];
s = http_arg_get(&hc->hc_url_args, t->tht_uniquename);
if(s != NULL) {
pri = atoi(s);
}
}
- channel_settings_write();
-
snprintf(buf, sizeof(buf), "/editchannel/%d", ch->ch_tag);
http_redirect(hc, buf);
return 0;
while(running) {
if(startupcounter == 0) {
+ channel_settings_write();
+
startupcounter = -1;
syslog(LOG_NOTICE,
"Initial input setup completed, starting output modules");
#include "pes.h"
#include "buffer.h"
#include "plugin.h"
+#include "channels.h"
static dtimer_t transport_monitor_timer;
th_stream_t *st;
char *chname;
const char *n;
-
+ config_entry_t *ce;
char pid[30];
char lang[30];
assert(t->tht_uniquename != NULL);
+
+ TAILQ_FOREACH(ce, &settings_list, ce_link) {
+ if(ce->ce_type != CFG_SUB || strcasecmp("transport", ce->ce_key))
+ continue;
+
+ n = config_get_str_sub(&ce->ce_sub, "uniquename", NULL);
+ if(n != NULL && !strcmp(n, t->tht_uniquename))
+ break;
+ }
+
+ if(ce != NULL) {
+ t->tht_prio = atoi(config_get_str_sub(&ce->ce_sub, "prio", "0"));
+ n = config_get_str_sub(&ce->ce_sub, "channel", NULL);
+ if(n != NULL)
+ ch = channel_find(n, 1, NULL);
+ }
+
t->tht_channel = ch;
LIST_INSERT_SORTED(&ch->ch_transports, t, tht_channel_link, transportcmp);
LIST_REMOVE(t, tht_channel_link);
t->tht_prio = prio;
LIST_INSERT_SORTED(&ch->ch_transports, t, tht_channel_link, transportcmp);
+ channel_settings_write();
}
LIST_REMOVE(t, tht_channel_link);
t->tht_channel = ch;
LIST_INSERT_SORTED(&ch->ch_transports, t, tht_channel_link, transportcmp);
+ channel_settings_write();
}