]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix problem with not storing owner module in epggrab_channel entries which results...
authorAdam Sutton <dev@adamsutton.me.uk>
Mon, 2 Jul 2012 14:02:39 +0000 (15:02 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Mon, 2 Jul 2012 14:02:39 +0000 (15:02 +0100)
src/epggrab/channel.c
src/epggrab/module.c
src/epggrab/module/opentv.c
src/epggrab/module/pyepg.c
src/epggrab/module/xmltv.c
src/epggrab/private.h

index f08afe9a4d1fced1cbd3d7ac24b84ce463d27827..abd576336fa6f4f67defa366968c56402a033198 100644 (file)
@@ -210,10 +210,12 @@ static int _ch_id_cmp ( void *a, void *b )
 
 /* Find/Create channel in the list */
 epggrab_channel_t *epggrab_channel_find
-  ( epggrab_channel_tree_t *tree, const char *id, int create, int *save )
+  ( epggrab_channel_tree_t *tree, const char *id, int create, int *save,
+    epggrab_module_t *owner )
 {
   epggrab_channel_t *ec;
   static epggrab_channel_t *skel = NULL;
+  assert(owner);
   if (!skel) skel = calloc(1, sizeof(epggrab_channel_t));
   skel->id = (char*)id;
 
@@ -225,10 +227,11 @@ epggrab_channel_t *epggrab_channel_find
   } else {
     ec = RB_INSERT_SORTED(tree, skel, link, _ch_id_cmp);
     if (!ec) {
-      ec     = skel;
-      skel   = NULL;
-      ec->id = strdup(id);
-      *save  = 1;
+      ec      = skel;
+      skel    = NULL;
+      ec->id  = strdup(id);
+      ec->mod = owner;
+      *save   = 1;
     }
   }
   return ec;
index e34f32728adc7a12ae259def56019115ea3bc7cb..bf0754552bb3a403ca817825c0b95fede853c5c4 100644 (file)
@@ -216,7 +216,7 @@ static void _epggrab_module_channel_load
   htsmsg_t *a;
   htsmsg_field_t *f;
 
-  epggrab_channel_t *ch = epggrab_channel_find(mod->channels, id, 1, &save);
+  epggrab_channel_t *ch = epggrab_channel_find(mod->channels, id, 1, &save, mod);
 
   if ((str = htsmsg_get_str(m, "name")))
     ch->name = strdup(str);
index ca2b34c71eb6710dd3f9ccbb8a9a6e4db64f866e..8fb2219b03849d6873ae095d6c9d86a4943f3f2e 100644 (file)
@@ -185,7 +185,8 @@ static epggrab_channel_t *_opentv_find_epggrab_channel
 {
   char chid[32];
   sprintf(chid, "%s-%d", mod->id, cid);
-  return epggrab_channel_find(&_opentv_channels, chid, create, save);
+  return epggrab_channel_find(&_opentv_channels, chid, create, save,
+                              (epggrab_module_t*)mod);
 }
 
 static epg_season_t *_opentv_find_season 
index 4dc7268a1cf476c0ec7b9e9836a29e3b80268dc1..8793f7d283c504bc27fe806e8b220efe78589a90 100644 (file)
 #include "epggrab/private.h"
 
 static epggrab_channel_tree_t _pyepg_channels;
+static epggrab_module_t      *_pyepg_module;   // primary module
 
 static epggrab_channel_t *_pyepg_channel_find
   ( const char *id, int create, int *save )
 {
-  return epggrab_channel_find(&_pyepg_channels, id, create, save);
+  return epggrab_channel_find(&_pyepg_channels, id, create, save,
+                              _pyepg_module);
 }
 
 /* **************************************************************************
@@ -439,9 +441,10 @@ void pyepg_init ( void )
                             NULL, _pyepg_parse, NULL, NULL);
 
   /* External module */
-  epggrab_module_ext_create(NULL, "pyepg", "PyEPG", "pyepg",
-                            _pyepg_parse, NULL,
-                            &_pyepg_channels);
+  _pyepg_module = (epggrab_module_t*)
+    epggrab_module_ext_create(NULL, "pyepg", "PyEPG", "pyepg",
+                              _pyepg_parse, NULL,
+                              &_pyepg_channels);
 }
 
 void pyepg_load ( void )
index 546f367a8ee1c594638eecec328c48d02da4e036..b34fab50b2787b64459fc2411f2b7f9ea5e68573 100644 (file)
 #define XMLTV_FIND_GRABBERS "/usr/bin/tv_find_grabbers"
 
 static epggrab_channel_tree_t _xmltv_channels;
+static epggrab_module_t      *_xmltv_module;
 
 static epggrab_channel_t *_xmltv_channel_find
   ( const char *id, int create, int *save )
 {
-  return epggrab_channel_find(&_xmltv_channels, id, create, save);
+  
+  return epggrab_channel_find(&_xmltv_channels, id, create, save,
+                              _xmltv_module);
 }
 
 /* **************************************************************************
@@ -494,9 +497,10 @@ static void _xmltv_load_grabbers ( void )
 void xmltv_init ( void )
 {
   /* External module */
-  epggrab_module_ext_create(NULL, "xmltv", "XMLTV", "xmltv",
-                            _xmltv_parse, NULL,
-                            &_xmltv_channels);
+  _xmltv_module = (epggrab_module_t*)
+    epggrab_module_ext_create(NULL, "xmltv", "XMLTV", "xmltv",
+                              _xmltv_parse, NULL,
+                              &_xmltv_channels);
 
   /* Standard modules */
   _xmltv_load_grabbers();
index ed1942d995d1973fa5c758f278ef592e8277a85d..c4b94374d44277db984c7543087f50ce9416aedf 100644 (file)
@@ -48,7 +48,8 @@ void      epggrab_module_channels_load ( epggrab_module_t *m );
 int epggrab_channel_link ( epggrab_channel_t *ec, struct channel *ch );
 
 epggrab_channel_t *epggrab_channel_find
-  ( epggrab_channel_tree_t *chs, const char *id, int create, int *save );
+  ( epggrab_channel_tree_t *chs, const char *id, int create, int *save,
+    epggrab_module_t *owner );
 
 /* **************************************************************************
  * Internal module routines