From: Jaroslav Kysela Date: Tue, 8 Dec 2015 09:53:03 +0000 (+0100) Subject: opentv: load the EPG channel settings on start X-Git-Tag: v4.2.1~1345 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3de1b542976ea95ca510b9966465b6dc3341055f;p=thirdparty%2Ftvheadend.git opentv: load the EPG channel settings on start --- diff --git a/src/epggrab.c b/src/epggrab.c index 79510a75c..d24afa7a9 100644 --- a/src/epggrab.c +++ b/src/epggrab.c @@ -179,10 +179,8 @@ static void _epggrab_load ( void ) idnode_notify_changed(&epggrab_conf.idnode); /* Load module config (channels) */ -#if 0 eit_load(); opentv_load(); -#endif pyepg_load(); xmltv_load(); } diff --git a/src/epggrab/channel.c b/src/epggrab/channel.c index 05f6e235e..55527bb9b 100644 --- a/src/epggrab/channel.c +++ b/src/epggrab/channel.c @@ -337,7 +337,11 @@ epggrab_channel_t *epggrab_channel_create 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; } @@ -393,7 +397,7 @@ void epggrab_channel_save( epggrab_channel_t *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]; @@ -401,7 +405,8 @@ void epggrab_channel_destroy( epggrab_channel_t *ec, int delconf ) /* 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); @@ -423,7 +428,7 @@ void epggrab_channel_flush { 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 ) @@ -542,7 +547,7 @@ epggrab_channel_class_save(idnode_t *self) 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 * diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index f611ba2e6..d12ca5361 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -820,3 +820,7 @@ void eit_init ( void ) void eit_done ( void ) { } + +void eit_load ( void ) +{ +} diff --git a/src/epggrab/module/opentv.c b/src/epggrab/module/opentv.c index 6505e4682..8924bd692 100644 --- a/src/epggrab/module/opentv.c +++ b/src/epggrab/module/opentv.c @@ -1031,5 +1031,9 @@ void opentv_done ( 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); } diff --git a/src/epggrab/private.h b/src/epggrab/private.h index d3b999dfa..2625c1b8a 100644 --- a/src/epggrab/private.h +++ b/src/epggrab/private.h @@ -58,7 +58,7 @@ epggrab_channel_t *epggrab_channel_find 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