]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
opentv: load the EPG channel settings on start
authorJaroslav Kysela <perex@perex.cz>
Tue, 8 Dec 2015 09:53:03 +0000 (10:53 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 8 Dec 2015 09:53:03 +0000 (10:53 +0100)
src/epggrab.c
src/epggrab/channel.c
src/epggrab/module/eit.c
src/epggrab/module/opentv.c
src/epggrab/private.h

index 79510a75c019953a67e1ae6c5fbb8ce9050fc380..d24afa7a97710acad1fb89c436562cda18415647 100644 (file)
@@ -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();
 }
index 05f6e235e439a4f26be59879940e187274a69581..55527bb9b239b7c0f1f6c98d8acecae94e27302d 100644 (file)
@@ -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 *
index f611ba2e687b09eabf0748e2f9b1965f7f5942b8..d12ca5361d7dcfccd4edee41fb901e0b4ee4b6f9 100644 (file)
@@ -820,3 +820,7 @@ void eit_init ( void )
 void eit_done ( void )
 {
 }
+
+void eit_load ( void )
+{
+}
index 6505e46822463d28a8cee475906cda99b1a378cb..8924bd69294694fc63e1b5b742cac6cfa4849121 100644 (file)
@@ -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);
 }
index d3b999dfa968b33712f7b7fbd7c33ff8278a4e20..2625c1b8a95411e4215d9b692091afbb990e628f 100644 (file)
@@ -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