]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epggrab: global cleanup, manage channels per module
authorJaroslav Kysela <perex@perex.cz>
Sat, 24 Oct 2015 20:30:30 +0000 (22:30 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sat, 24 Oct 2015 20:30:32 +0000 (22:30 +0200)
The epggrab channel mapping was a big mess. For example XMLTV has
only one channels set for all input modules (external/internal)
so the things were merged and very confusing. Now, all sources
are taken as separate inputs with clean and straight mapping.

Also, show the path in EPG Channel Mapping.

src/epggrab.c
src/epggrab.h
src/epggrab/channel.c
src/epggrab/module.c
src/epggrab/module/eit.c
src/epggrab/module/opentv.c
src/epggrab/module/psip.c
src/epggrab/module/pyepg.c
src/epggrab/module/xmltv.c
src/epggrab/private.h

index ed0011d0495090ac3368cfc604c49f36e0ac3871..c474ea184de96693909541d7e32cc6803d2b8057 100644 (file)
@@ -399,7 +399,7 @@ void epggrab_done ( void )
     if (mod->done)
       mod->done(mod);
     pthread_mutex_lock(&global_lock);
-    epggrab_channel_flush(mod->channels, 0);
+    epggrab_channel_flush(mod, 0);
     free((void *)mod->id);
     free((void *)mod->name);
     free(mod);
index ab071bc990ba88f1a2a3c7d59413845049010dde..21c6194b64d97eefdf600a83d1192e67a0acd21a 100644 (file)
@@ -82,7 +82,6 @@ typedef struct epggrab_channel
   idnode_t                  idnode;
   TAILQ_ENTRY(epggrab_channel) all_link; ///< Global link
   RB_ENTRY(epggrab_channel) link;     ///< Global tree link
-  epggrab_channel_tree_t    *tree;    ///< Member of this tree
   epggrab_module_t          *mod;     ///< Linked module
 
   int                       enabled;  ///< Enabled/disabled
@@ -147,7 +146,7 @@ struct epggrab_module
   int                          enabled;   ///< Whether the module is enabled
   int                          active;    ///< Whether the module is active
   int                          priority;  ///< Priority of the module
-  epggrab_channel_tree_t       *channels; ///< Channel list
+  epggrab_channel_tree_t       channels;  ///< Channel list
 
   /* Activate */
   int       (*activate) ( void *m, int activate );
@@ -239,8 +238,6 @@ struct epggrab_module_ota
 {
   epggrab_module_t               ;      ///< Parent object
 
-  //TAILQ_HEAD(, epggrab_ota_mux)  muxes; ///< List of related muxes
-
   /* Transponder tuning */
   int  (*start) ( epggrab_ota_map_t *map, struct mpegts_mux *mm );
   int  (*tune)  ( epggrab_ota_map_t *map, epggrab_ota_mux_t *om,
index 11c6965bc33fabf32a8cf511e748afdccb6f5ebb..b4232525282516213963fc41a16f5e8878a8e8e8 100644 (file)
@@ -217,8 +217,6 @@ epggrab_channel_t *epggrab_channel_create
 {
   epggrab_channel_t *ec;
 
-  assert(owner->channels);
-
   if (htsmsg_get_str(conf, "id") == NULL)
     return NULL;
 
@@ -232,21 +230,19 @@ epggrab_channel_t *epggrab_channel_create
 
   ec->mod = owner;
   ec->enabled = 1;
-  ec->tree = owner->channels;
 
   if (conf)
     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)) abort();
 
   return ec;
 }
 
 /* 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_module_t *owner )
+  ( epggrab_module_t *mod, const char *id, int create, int *save )
 {
   char *s;
   epggrab_channel_t *ec;
@@ -263,19 +259,17 @@ epggrab_channel_t *epggrab_channel_find
 
   /* Find */
   if (!create) {
-    ec = RB_FIND(tree, epggrab_channel_skel, link, _ch_id_cmp);
+    ec = RB_FIND(&mod->channels, epggrab_channel_skel, link, _ch_id_cmp);
 
   /* Find/Create */
   } else {
-    ec = RB_INSERT_SORTED(tree, epggrab_channel_skel, link, _ch_id_cmp);
+    ec = RB_INSERT_SORTED(&mod->channels, epggrab_channel_skel, link, _ch_id_cmp);
     if (!ec) {
-      assert(owner);
       ec       = epggrab_channel_skel;
       SKEL_USED(epggrab_channel_skel);
       ec->enabled = 1;
-      ec->tree = tree;
       ec->id   = strdup(ec->id);
-      ec->mod  = owner;
+      ec->mod  = mod;
       TAILQ_INSERT_TAIL(&epggrab_channel_entries, ec, all_link);
 
       if (idnode_insert(&ec->idnode, NULL, &epggrab_channel_class, 0))
@@ -302,7 +296,7 @@ void epggrab_channel_destroy( epggrab_channel_t *ec, int delconf )
 
   /* Already linked */
   epggrab_channel_links_delete(ec, 0);
-  RB_REMOVE(ec->tree, ec, link);
+  RB_REMOVE(&ec->mod->channels, ec, link);
   TAILQ_REMOVE(&epggrab_channel_entries, ec, all_link);
   idnode_unlink(&ec->idnode);
 
@@ -318,15 +312,11 @@ void epggrab_channel_destroy( epggrab_channel_t *ec, int delconf )
 }
 
 void epggrab_channel_flush
-  ( epggrab_channel_tree_t *tree, int delconf )
+  ( epggrab_module_t *mod, int delconf )
 {
   epggrab_channel_t *ec;
-  if (tree == NULL)
-    return;
-  while ((ec = RB_FIRST(tree)) != NULL) {
-    assert(tree == ec->tree);
+  while ((ec = RB_FIRST(&mod->channels)) != NULL)
     epggrab_channel_destroy(ec, delconf);
-  }
 }
 
 /* **************************************************************************
@@ -339,10 +329,9 @@ void epggrab_channel_add ( channel_t *ch )
   epggrab_channel_t *egc;
 
   LIST_FOREACH(mod, &epggrab_modules, link)
-    if (mod->channels)
-      RB_FOREACH(egc, mod->channels, link)
-        if (epggrab_channel_match_and_link(egc, ch))
-          break;
+    RB_FOREACH(egc, &mod->channels, link)
+      if (epggrab_channel_match_and_link(egc, ch))
+        break;
 }
 
 void epggrab_channel_rem ( channel_t *ch )
@@ -376,8 +365,8 @@ epggrab_channel_find_by_id ( const char *id )
   strncpy(buf, id, sizeof(buf));
   buf[sizeof(buf)-1] = '\0';
   if ((mid = strtok_r(buf, "|", &cid)) && cid)
-    if ((mod = epggrab_module_find_by_id(mid)) && mod->channels)
-      return epggrab_channel_find(mod->channels, cid, 0, NULL, NULL);
+    if ((mod = epggrab_module_find_by_id(mid)) != NULL)
+      return epggrab_channel_find(mod, cid, 0, NULL);
   return NULL;
 }
 
@@ -421,6 +410,17 @@ epggrab_channel_class_module_get ( void *obj )
   return &prop_sbuf_ptr;
 }
 
+static const void *
+epggrab_channel_class_path_get ( void *obj )
+{
+  epggrab_channel_t *ec = obj;
+  if (ec->mod->type == EPGGRAB_INT || ec->mod->type == EPGGRAB_EXT)
+    snprintf(prop_sbuf, PROP_SBUF_LEN, "%s", ((epggrab_module_int_t *)ec->mod)->path ?: "");
+  else
+    prop_sbuf[0] = '\0';
+  return &prop_sbuf_ptr;
+}
+
 static const void *
 epggrab_channel_class_channels_get ( void *obj )
 {
@@ -467,6 +467,13 @@ const idclass_t epggrab_channel_class = {
       .get      = epggrab_channel_class_module_get,
       .opts     = PO_RDONLY | PO_NOSAVE,
     },
+    {
+      .type     = PT_STR,
+      .id       = "path",
+      .name     = N_("Path"),
+      .get      = epggrab_channel_class_path_get,
+      .opts     = PO_RDONLY | PO_NOSAVE,
+    },
     {
       .type     = PT_STR,
       .id       = "id",
index d3b46e8814b97d99193e2c84ee5cedb20cb8a429..1f66b8dbbdfeb3949cd825953ce50aafef954139 100644 (file)
@@ -158,6 +158,14 @@ const idclass_t epggrab_class_mod_int = {
   .ic_class      = "epggrab_mod_int",
   .ic_caption    = N_("Internal EPG Grabber"),
   .ic_properties = (const property_t[]){
+    {
+      .type   = PT_STR,
+      .id     = "path",
+      .name   = N_("Path"),
+      .off    = offsetof(epggrab_module_int_t, path),
+      .opts   = PO_RDONLY | PO_NOSAVE,
+      .group  = 1
+    },
     {}
   }
 };
@@ -194,8 +202,7 @@ const idclass_t epggrab_class_mod_ota = {
 
 epggrab_module_t *epggrab_module_create
   ( epggrab_module_t *skel, const idclass_t *cls,
-    const char *id, const char *name, int priority,
-    epggrab_channel_tree_t *channels )
+    const char *id, const char *name, int priority )
 {
   assert(skel);
 
@@ -203,7 +210,7 @@ epggrab_module_t *epggrab_module_create
   skel->id       = strdup(id);
   skel->name     = strdup(name);
   skel->priority = priority;
-  skel->channels = channels;
+  RB_INIT(&skel->channels);
 
   /* Insert */
   assert(!epggrab_module_find_by_id(id));
@@ -259,7 +266,7 @@ void epggrab_module_channels_load ( epggrab_module_t *mod )
 {
   htsmsg_t *m, *e;
   htsmsg_field_t *f;
-  if (!mod || !mod->channels) return;
+  if (!mod) return;
   if ((m = hts_settings_load_r(1, "epggrab/%s/channels", mod->id))) {
     HTSMSG_FOREACH(f, m) {
       if ((e = htsmsg_get_map_by_field(f)))
@@ -288,8 +295,7 @@ epggrab_module_int_t *epggrab_module_int_create
     const char *path,
     char* (*grab) (void*m),
     int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
-    htsmsg_t* (*trans) (void *mod, char *data),
-    epggrab_channel_tree_t *channels )
+    htsmsg_t* (*trans) (void *mod, char *data) )
 {
   /* Allocate data */
   if (!skel) skel = calloc(1, sizeof(epggrab_module_int_t));
@@ -297,12 +303,11 @@ epggrab_module_int_t *epggrab_module_int_create
   /* Pass through */
   epggrab_module_create((epggrab_module_t*)skel,
                         cls ?: &epggrab_class_mod_int,
-                        id, name, priority, channels);
+                        id, name, priority);
 
   /* Int data */
   skel->type     = EPGGRAB_INT;
   skel->path     = strdup(path);
-  skel->channels = channels;
   skel->grab     = grab  ?: epggrab_module_grab_spawn;
   skel->trans    = trans ?: epggrab_module_trans_xml;
   skel->parse    = parse;
@@ -505,8 +510,7 @@ epggrab_module_ext_t *epggrab_module_ext_create
   ( epggrab_module_ext_t *skel,
     const char *id, const char *name, int priority, const char *sockid,
     int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
-    htsmsg_t* (*trans) (void *mod, char *data),
-    epggrab_channel_tree_t *channels )
+    htsmsg_t* (*trans) (void *mod, char *data) )
 {
   char path[512];
 
@@ -518,8 +522,7 @@ epggrab_module_ext_t *epggrab_module_ext_create
   epggrab_module_int_create((epggrab_module_int_t*)skel,
                             &epggrab_class_mod_ext,
                             id, name, priority, path,
-                            NULL, parse, trans,
-                            channels);
+                            NULL, parse, trans);
 
   /* Local */
   skel->type     = EPGGRAB_EXT;
@@ -536,15 +539,14 @@ epggrab_module_ext_t *epggrab_module_ext_create
 epggrab_module_ota_t *epggrab_module_ota_create
   ( epggrab_module_ota_t *skel,
     const char *id, const char *name, int priority,
-    epggrab_ota_module_ops_t *ops,
-    epggrab_channel_tree_t *channels )
+    epggrab_ota_module_ops_t *ops )
 {
   if (!skel) skel = calloc(1, sizeof(epggrab_module_ota_t));
   
   /* Pass through */
   epggrab_module_create((epggrab_module_t*)skel,
                         &epggrab_class_mod_ota,
-                        id, name, priority, channels);
+                        id, name, priority);
 
   /* Setup */
   skel->type     = EPGGRAB_OTA;
@@ -552,7 +554,6 @@ epggrab_module_ota_t *epggrab_module_ota_create
   skel->start    = ops->start;
   skel->done     = ops->done;
   skel->tune     = ops->tune;
-  //TAILQ_INIT(&skel->muxes);
 
   return skel;
 }
index b55be65917b973bbaf5e2ceb3c49a2db15264692..003418573a7fc85043d0dcd5e86417b001517079 100644 (file)
@@ -789,11 +789,11 @@ void eit_init ( void )
     .tune  = _eit_tune,
   };
 
-  epggrab_module_ota_create(NULL, "eit", "EIT: DVB Grabber", 1, &ops, NULL);
-  epggrab_module_ota_create(NULL, "uk_freesat", "UK: Freesat", 5, &ops, NULL);
-  epggrab_module_ota_create(NULL, "uk_freeview", "UK: Freeview", 5, &ops, NULL);
-  epggrab_module_ota_create(NULL, "viasat_baltic", "VIASAT: Baltic", 5, &ops, NULL);
-  epggrab_module_ota_create(NULL, "Bulsatcom_39E", "Bulsatcom: Bula 39E", 5, &ops, NULL);
+  epggrab_module_ota_create(NULL, "eit", "EIT: DVB Grabber", 1, &ops);
+  epggrab_module_ota_create(NULL, "uk_freesat", "UK: Freesat", 5, &ops);
+  epggrab_module_ota_create(NULL, "uk_freeview", "UK: Freeview", 5, &ops);
+  epggrab_module_ota_create(NULL, "viasat_baltic", "VIASAT: Baltic", 5, &ops);
+  epggrab_module_ota_create(NULL, "Bulsatcom_39E", "Bulsatcom: Bula 39E", 5, &ops);
 }
 
 void eit_done ( void )
index ad53f5f9f634a23fae78d54b3a7e0f812ccfe8fe..af36c68da779d0e2f799b275f1206d666011a0b2 100644 (file)
@@ -34,8 +34,6 @@
 #include "settings.h"
 #include "input.h"
 
-static epggrab_channel_tree_t _opentv_channels;
-
 #define OPENTV_TITLE_BASE   0xA0
 #define OPENTV_SUMMARY_BASE 0xA8
 #define OPENTV_TABLE_MASK   0xFC
@@ -170,8 +168,7 @@ static epggrab_channel_t *_opentv_find_epggrab_channel
 {
   char chid[256];
   snprintf(chid, sizeof(chid), "%s-%d", mod->id, cid);
-  return epggrab_channel_find(&_opentv_channels, chid, create, save,
-                              (epggrab_module_t*)mod);
+  return epggrab_channel_find((epggrab_module_t*)mod, chid, create, save);
 }
 
 /* ************************************************************************
@@ -945,9 +942,9 @@ static int _opentv_prov_load_one ( const char *id, htsmsg_t *m )
 
   /* Create */
   sprintf(nbuf, "OpenTV: %s", name);
-  mod = (opentv_module_t*)
+  mod = (opentv_module_t *)
     epggrab_module_ota_create(calloc(1, sizeof(opentv_module_t)),
-                              ibuf, nbuf, 2, &ops, NULL);
+                              ibuf, nbuf, 2, &ops);
 
   /* Add provider details */
   mod->dict     = dict;
@@ -960,7 +957,6 @@ static int _opentv_prov_load_one ( const char *id, htsmsg_t *m )
   mod->channel  = _pid_list_to_array(cl);
   mod->title    = _pid_list_to_array(tl);
   mod->summary  = _pid_list_to_array(sl);
-  mod->channels = &_opentv_channels;
   _opentv_compile_pattern_list(&mod->p_snum, htsmsg_get_list(m, "season_num"));
   _opentv_compile_pattern_list(&mod->p_enum, htsmsg_get_list(m, "episode_num"));
   _opentv_compile_pattern_list(&mod->p_pnum, htsmsg_get_list(m, "part_num"));
@@ -996,8 +992,6 @@ void opentv_init ( void )
 {
   htsmsg_t *m;
 
-  RB_INIT(&_opentv_channels);
-
   /* Load dictionaries */
   if ((m = hts_settings_load("epggrab/opentv/dict")))
     _opentv_dict_load(m);
@@ -1019,7 +1013,6 @@ void opentv_done ( void )
   opentv_dict_t *dict;
   opentv_genre_t *genre;
 
-  epggrab_channel_flush(&_opentv_channels, 0);
   while ((dict = RB_FIRST(&_opentv_dicts)) != NULL) {
     RB_REMOVE(&_opentv_dicts, dict, h_link);
     huffman_tree_destroy(dict->codes);
index ce62c7b06785a2a618a313b16f6d8f92adf13d4c..81df689b64d06afe053d4325bfc7606ec7c6b3ea 100644 (file)
@@ -405,7 +405,7 @@ void psip_init ( void )
     .tune  = _psip_tune,
   };
 
-  epggrab_module_ota_create(NULL, "psip", "PSIP: ATSC Grabber", 1, &ops, NULL);
+  epggrab_module_ota_create(NULL, "psip", "PSIP: ATSC Grabber", 1, &ops);
 }
 
 void psip_done ( void )
index 9fddbd5eb3586e8c90b3bef3e20f64347b317fbb..20cd69fcff73e5a5d45491185f8fa1428c4d7a26 100644 (file)
 #include "epggrab.h"
 #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,
-                              _pyepg_module);
-}
-
 /* **************************************************************************
  * Parsing
  * *************************************************************************/
@@ -84,7 +74,7 @@ static int _pyepg_parse_channel
   if ((attr    = htsmsg_get_map(data, "attrib")) == NULL) return 0;
   if ((str     = htsmsg_get_str(attr, "id")) == NULL) return 0;
   if ((tags    = htsmsg_get_map(data, "tags")) == NULL) return 0;
-  if (!(ch     = _pyepg_channel_find(str, 1, &save))) return 0;
+  if (!(ch     = epggrab_channel_find(mod, str, 1, &save))) return 0;
   stats->channels.total++;
   if (save) stats->channels.created++;
 
@@ -360,7 +350,7 @@ static int _pyepg_parse_schedule
 
   if ((attr = htsmsg_get_map(data, "attrib")) == NULL) return 0;
   if ((str  = htsmsg_get_str(attr, "channel")) == NULL) return 0;
-  if ((ec   = _pyepg_channel_find(str, 0, NULL)) == NULL) return 0;
+  if ((ec   = epggrab_channel_find(mod, str, 0, NULL)) == NULL) return 0;
   if ((tags = htsmsg_get_map(data, "tags")) == NULL) return 0;
 
   HTSMSG_FOREACH(f, tags) {
@@ -438,24 +428,19 @@ void pyepg_init ( void )
 {
   char buf[256];
 
-  RB_INIT(&_pyepg_channels);
-
   /* Internal module */
   if (find_exec("pyepg", buf, sizeof(buf)-1))
     epggrab_module_int_create(NULL, NULL,
                               "pyepg-internal", "PyEPG", 4, buf,
-                              NULL, _pyepg_parse, NULL, NULL);
+                              NULL, _pyepg_parse, NULL);
 
   /* External module */
-  _pyepg_module = (epggrab_module_t*)
-    epggrab_module_ext_create(NULL, "pyepg", "PyEPG", 4, "pyepg",
-                              _pyepg_parse, NULL,
-                              &_pyepg_channels);
+  epggrab_module_ext_create(NULL, "pyepg", "PyEPG", 4, "pyepg",
+                            _pyepg_parse, NULL);
 }
 
 void pyepg_done ( void )
 {
-  epggrab_channel_flush(&_pyepg_channels, 0);
 }
 
 void pyepg_load ( void )
index 8286e95df4a6528f8198041d84258631e7f251a8..e25d8f3677ea83f8d08d0cf30a10def27b77ef13 100644 (file)
 #define XMLTV_FIND "tv_find_grabbers"
 #define XMLTV_GRAB "tv_grab_"
 
-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,
-                              _xmltv_module);
-}
-
 /* **************************************************************************
  * Parsing
  * *************************************************************************/
@@ -588,7 +578,7 @@ static int _xmltv_parse_programme
   if((attribs = htsmsg_get_map(body,    "attrib"))  == NULL) return 0;
   if((tags    = htsmsg_get_map(body,    "tags"))    == NULL) return 0;
   if((chid    = htsmsg_get_str(attribs, "channel")) == NULL) return 0;
-  if((ec      = _xmltv_channel_find(chid, 1, &chsave)) == NULL) return 0;
+  if((ec      = epggrab_channel_find(mod, chid, 1, &chsave)) == NULL) return 0;
   if (chsave) {
     epggrab_channel_updated(ec);
     stats->channels.created++;
@@ -628,7 +618,7 @@ static int _xmltv_parse_channel
   if((attribs = htsmsg_get_map(body, "attrib"))  == NULL) return 0;
   if((id      = htsmsg_get_str(attribs, "id"))   == NULL) return 0;
   if((tags    = htsmsg_get_map(body, "tags"))    == NULL) return 0;
-  if((ch      = _xmltv_channel_find(id, 1, &save)) == NULL) return 0;
+  if((ch      = epggrab_channel_find(mod, id, 1, &save)) == NULL) return 0;
   stats->channels.total++;
   if (save) stats->channels.created++;
   
@@ -718,7 +708,7 @@ static void _xmltv_load_grabbers ( void )
         outbuf[i] = '\0';
         sprintf(name, "XMLTV: %s", &outbuf[n]);
         epggrab_module_int_create(NULL, NULL, &outbuf[p], name, 3, &outbuf[p],
-                                  NULL, _xmltv_parse, NULL, NULL);
+                                  NULL, _xmltv_parse, NULL);
         p = n = i + 1;
       } else if ( outbuf[i] == '\\') {
         memmove(outbuf, outbuf + 1, strlen(outbuf));
@@ -751,6 +741,7 @@ static void _xmltv_load_grabbers ( void )
       if ((dir = opendir(tmp))) {
         while ((de = readdir(dir))) {
           if (strstr(de->d_name, XMLTV_GRAB) != de->d_name) continue;
+          if (de->d_name[0] && de->d_name[strlen(de->d_name)-1] == '~') continue;
           snprintf(bin, sizeof(bin), "%s/%s", tmp, de->d_name);
           if (epggrab_module_find_by_id(bin)) continue;
           if (stat(bin, &st)) continue;
@@ -763,7 +754,7 @@ static void _xmltv_load_grabbers ( void )
             if (outbuf[outlen-1] == '\n') outbuf[outlen-1] = '\0';
             snprintf(name, sizeof(name), "XMLTV: %s", outbuf);
             epggrab_module_int_create(NULL, NULL, bin, name, 3, bin,
-                                      NULL, _xmltv_parse, NULL, NULL);
+                                      NULL, _xmltv_parse, NULL);
             free(outbuf);
           } else {
             if (rd >= 0)
@@ -780,13 +771,9 @@ static void _xmltv_load_grabbers ( void )
 
 void xmltv_init ( void )
 {
-  RB_INIT(&_xmltv_channels);
-
   /* External module */
-  _xmltv_module = (epggrab_module_t*)
-    epggrab_module_ext_create(NULL, "xmltv", "XMLTV", 3, "xmltv",
-                              _xmltv_parse, NULL,
-                              &_xmltv_channels);
+  epggrab_module_ext_create(NULL, "xmltv", "XMLTV", 3, "xmltv",
+                            _xmltv_parse, NULL);
 
   /* Standard modules */
   _xmltv_load_grabbers();
@@ -794,7 +781,6 @@ void xmltv_init ( void )
 
 void xmltv_done ( void )
 {
-  epggrab_channel_flush(&_xmltv_channels, 0);
 }
 
 void xmltv_load ( void )
index b7db9fa8892a6880e1a44a526232e1679ee3212f..edddb8cf1f32efd6801e1ace0bebdf5f359b22d9 100644 (file)
@@ -27,8 +27,7 @@ struct mpegts_mux;
 
 epggrab_module_t *epggrab_module_create
   ( epggrab_module_t *skel, const idclass_t *cls,
-    const char *id, const char *name, int priority,
-    epggrab_channel_tree_t *channels );
+    const char *id, const char *name, int priority );
 
 char     *epggrab_module_grab_spawn ( void *m );
 htsmsg_t *epggrab_module_trans_xml  ( void *m, char *data );
@@ -54,14 +53,13 @@ epggrab_channel_t *epggrab_channel_create
   ( epggrab_module_t *owner, htsmsg_t *conf, const char *uuid );
 
 epggrab_channel_t *epggrab_channel_find
-  ( epggrab_channel_tree_t *chs, const char *id, int create, int *save,
-    epggrab_module_t *owner );
+  ( epggrab_module_t *mod, const char *id, int create, int *save );
 
 void epggrab_channel_save ( epggrab_channel_t *ec );
 void epggrab_channel_destroy
   ( epggrab_channel_t *ec, int delconf );
 void epggrab_channel_flush
-  ( epggrab_channel_tree_t *tree, int delconf );
+  ( epggrab_module_t *mod, int delconf );
 
 void epggrab_channel_init(void);
 void epggrab_channel_done(void);
@@ -76,8 +74,7 @@ epggrab_module_int_t *epggrab_module_int_create
     const char *path,
     char* (*grab) (void*m),
     int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
-    htsmsg_t* (*trans) (void *mod, char *data),
-    epggrab_channel_tree_t *channels );
+    htsmsg_t* (*trans) (void *mod, char *data) );
 
 /* **************************************************************************
  * External module routines
@@ -88,8 +85,7 @@ epggrab_module_ext_t *epggrab_module_ext_create
     const char *id, const char *name, int priority,
     const char *sockid,
     int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
-    htsmsg_t* (*trans) (void *mod, char *data),
-    epggrab_channel_tree_t *channels );
+    htsmsg_t* (*trans) (void *mod, char *data) );
 
 /* **************************************************************************
  * OTA module routines
@@ -106,8 +102,7 @@ typedef struct epggrab_ota_module_ops {
 epggrab_module_ota_t *epggrab_module_ota_create
   ( epggrab_module_ota_t *skel,
     const char *id, const char *name, int priority,
-    epggrab_ota_module_ops_t *ops,
-    epggrab_channel_tree_t *channels );
+    epggrab_ota_module_ops_t *ops );
 
 /* **************************************************************************
  * OTA mux link routines