Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
opentv: load the EPG channel settings on start
  • Loading branch information
perexg committed Dec 8, 2015
1 parent f02851a commit 3de1b54
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/epggrab.c
Expand Up @@ -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();
}
Expand Down
15 changes: 10 additions & 5 deletions src/epggrab/channel.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -393,15 +397,16 @@ 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];

if (ec == NULL) return;

/* 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);

Expand All @@ -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 )
Expand Down Expand Up @@ -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 *
Expand Down
4 changes: 4 additions & 0 deletions src/epggrab/module/eit.c
Expand Up @@ -820,3 +820,7 @@ void eit_init ( void )
void eit_done ( void )
{
}

void eit_load ( void )
{
}
6 changes: 5 additions & 1 deletion src/epggrab/module/opentv.c
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/epggrab/private.h
Expand Up @@ -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
Expand Down

0 comments on commit 3de1b54

Please sign in to comment.