Fix problem with not storing owner module in epggrab_channel entries which results in things going horrible wrong.

This commit is contained in:
Adam Sutton 2012-07-02 15:02:39 +01:00
parent 689d381fc7
commit bafe0bf53f
6 changed files with 28 additions and 16 deletions

View 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;

View 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);

View 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

View file

@ -30,11 +30,13 @@
#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 )

View file

@ -40,11 +40,14 @@
#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();

View 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