idnode_load(&ec->idnode, conf);
TAILQ_INSERT_TAIL(&epggrab_channel_entries, ec, all_link);
- if (RB_INSERT_SORTED(&owner->channels, ec, link, _ch_id_cmp)) abort();
+ if (RB_INSERT_SORTED(&owner->channels, ec, link, _ch_id_cmp)) {
+ tvherror("epggrab", "removing duplicate channel id '%s' (uuid '%s')", ec->id, uuid);
+ epggrab_channel_destroy(ec, 1, 0);
+ return NULL;
+ }
return ec;
}
htsmsg_destroy(m);
}
-void epggrab_channel_destroy( epggrab_channel_t *ec, int delconf )
+void epggrab_channel_destroy( epggrab_channel_t *ec, int delconf, int rb_remove )
{
char ubuf[UUID_HEX_SIZE];
/* Already linked */
epggrab_channel_links_delete(ec, 0);
- RB_REMOVE(&ec->mod->channels, ec, link);
+ if (rb_remove)
+ RB_REMOVE(&ec->mod->channels, ec, link);
TAILQ_REMOVE(&epggrab_channel_entries, ec, all_link);
idnode_unlink(&ec->idnode);
{
epggrab_channel_t *ec;
while ((ec = RB_FIRST(&mod->channels)) != NULL)
- epggrab_channel_destroy(ec, delconf);
+ epggrab_channel_destroy(ec, delconf, 1);
}
void epggrab_channel_begin_scan ( epggrab_module_t *mod )
static void
epggrab_channel_class_delete(idnode_t *self)
{
- epggrab_channel_destroy((epggrab_channel_t *)self, 1);
+ epggrab_channel_destroy((epggrab_channel_t *)self, 1, 1);
}
static const void *
void opentv_load ( void )
{
- // TODO: do we want to keep a list of channels stored?
+ epggrab_module_t *m;
+
+ LIST_FOREACH(m, &epggrab_modules, link)
+ if (strncmp(m->id, "opentv-", 7) == 0)
+ epggrab_module_channels_load(m->id);
}
void epggrab_channel_save ( epggrab_channel_t *ec );
void epggrab_channel_destroy
- ( epggrab_channel_t *ec, int delconf );
+ ( epggrab_channel_t *ec, int delconf, int rb_remove );
void epggrab_channel_flush
( epggrab_module_t *mod, int delconf );
void epggrab_channel_begin_scan