pthread_mutex_lock(&global_lock);
epggrab_channel_flush(mod, 0);
free((void *)mod->id);
+ free((void *)mod->saveid);
free((void *)mod->name);
free(mod);
}
EPGGRAB_EXT,
} type; ///< Grabber type
const char *id; ///< Module identifier
+ const char *saveid; ///< Module save identifier
const char *name; ///< Module name (for display)
int enabled; ///< Whether the module is enabled
int active; ///< Whether the module is active
htsmsg_t *m = htsmsg_create_map();
idnode_save(&ec->idnode, m);
hts_settings_save(m, "epggrab/%s/channels/%s",
- ec->mod->id, idnode_uuid_as_sstr(&ec->idnode));
+ ec->mod->saveid, idnode_uuid_as_sstr(&ec->idnode));
htsmsg_destroy(m);
}
if (delconf)
hts_settings_remove("epggrab/%s/channels/%s",
- ec->mod->id, idnode_uuid_as_sstr(&ec->idnode));
+ ec->mod->saveid, idnode_uuid_as_sstr(&ec->idnode));
free(ec->comment);
free(ec->name);
epggrab_channel_t *ec = (epggrab_channel_t*)self;
snprintf(prop_sbuf, PROP_SBUF_LEN, "%s: %s (%s)",
- ec->mod->name, ec->name ?: ec->id, ec->id);
+ ec->name ?: ec->id, ec->id, ec->mod->name);
return prop_sbuf;
}
epggrab_channel_destroy((epggrab_channel_t *)self, 1);
}
+static const void *
+epggrab_channel_class_modid_get ( void *obj )
+{
+ epggrab_channel_t *ec = obj;
+ snprintf(prop_sbuf, PROP_SBUF_LEN, "%s", ec->mod->id ?: "");
+ return &prop_sbuf_ptr;
+}
+
+static int
+epggrab_channel_class_modid_set ( void *obj, const void *p )
+{
+ return 0;
+}
+
static const void *
epggrab_channel_class_module_get ( void *obj )
{
.name = N_("Enabled"),
.off = offsetof(epggrab_channel_t, enabled),
},
+ {
+ .type = PT_STR,
+ .id = "modid",
+ .name = N_("Module ID"),
+ .get = epggrab_channel_class_modid_get,
+ .set = epggrab_channel_class_modid_set,
+ .opts = PO_RDONLY | PO_HIDDEN,
+ },
{
.type = PT_STR,
.id = "module",
epggrab_module_t *epggrab_module_create
( epggrab_module_t *skel, const idclass_t *cls,
- const char *id, const char *name, int priority )
+ const char *id, const char *saveid,
+ const char *name, int priority )
{
assert(skel);
/* Setup */
skel->id = strdup(id);
+ skel->saveid = strdup(saveid ?: id);
skel->name = strdup(name);
skel->priority = priority;
RB_INIT(&skel->channels);
* Module channel routines
* *************************************************************************/
-void epggrab_module_channels_load ( epggrab_module_t *mod )
+void epggrab_module_channels_load ( const char *modid )
{
+ epggrab_module_t *mod = NULL;
htsmsg_t *m, *e;
htsmsg_field_t *f;
- if (!mod) return;
- if ((m = hts_settings_load_r(1, "epggrab/%s/channels", mod->id))) {
+ const char *id;
+ if (!modid) return;
+ if ((m = hts_settings_load_r(1, "epggrab/%s/channels", modid))) {
HTSMSG_FOREACH(f, m) {
- if ((e = htsmsg_get_map_by_field(f)))
- epggrab_channel_create(mod, e, f->hmf_name);
+ if ((e = htsmsg_get_map_by_field(f))) {
+ id = htsmsg_get_str(e, "modid") ?: modid;
+ if (mod == NULL || strcmp(mod->id, id))
+ mod = epggrab_module_find_by_id(id);
+ if (mod)
+ epggrab_channel_create(mod, e, f->hmf_name);
+ }
}
htsmsg_destroy(m);
}
epggrab_module_int_t *epggrab_module_int_create
( epggrab_module_int_t *skel, const idclass_t *cls,
- const char *id, const char *name, int priority,
+ const char *id, const char *saveid,
+ const char *name, int priority,
const char *path,
char* (*grab) (void*m),
int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
/* Pass through */
epggrab_module_create((epggrab_module_t*)skel,
cls ?: &epggrab_class_mod_int,
- id, name, priority);
+ id, saveid, name, priority);
/* Int data */
skel->type = EPGGRAB_INT;
*/
epggrab_module_ext_t *epggrab_module_ext_create
( epggrab_module_ext_t *skel,
- const char *id, const char *name, int priority, const char *sockid,
+ const char *id, const char *saveid,
+ 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) )
{
hts_settings_buildpath(path, sizeof(path), "epggrab/%s.sock", sockid);
epggrab_module_int_create((epggrab_module_int_t*)skel,
&epggrab_class_mod_ext,
- id, name, priority, path,
+ id, saveid, name, priority, path,
NULL, parse, trans);
/* Local */
epggrab_module_ota_t *epggrab_module_ota_create
( epggrab_module_ota_t *skel,
- const char *id, const char *name, int priority,
+ const char *id, const char *saveid,
+ const char *name, int priority,
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);
+ id, saveid, name, priority);
/* Setup */
skel->type = EPGGRAB_OTA;
.tune = _eit_tune,
};
- 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);
+ epggrab_module_ota_create(NULL, "eit", NULL, "EIT: DVB Grabber", 1, &ops);
+ epggrab_module_ota_create(NULL, "uk_freesat", NULL, "UK: Freesat", 5, &ops);
+ epggrab_module_ota_create(NULL, "uk_freeview", NULL, "UK: Freeview", 5, &ops);
+ epggrab_module_ota_create(NULL, "viasat_baltic", NULL, "VIASAT: Baltic", 5, &ops);
+ epggrab_module_ota_create(NULL, "Bulsatcom_39E", NULL, "Bulsatcom: Bula 39E", 5, &ops);
}
void eit_done ( void )
sprintf(nbuf, "OpenTV: %s", name);
mod = (opentv_module_t *)
epggrab_module_ota_create(calloc(1, sizeof(opentv_module_t)),
- ibuf, nbuf, 2, &ops);
+ ibuf, NULL, nbuf, 2, &ops);
/* Add provider details */
mod->dict = dict;
.tune = _psip_tune,
};
- epggrab_module_ota_create(NULL, "psip", "PSIP: ATSC Grabber", 1, &ops);
+ epggrab_module_ota_create(NULL, "psip", NULL, "PSIP: ATSC Grabber", 1, &ops);
}
void psip_done ( void )
/* Internal module */
if (find_exec("pyepg", buf, sizeof(buf)-1))
epggrab_module_int_create(NULL, NULL,
- "pyepg-internal", "PyEPG", 4, buf,
+ "pyepg-internal", "pyepg", "PyEPG", 4, buf,
NULL, _pyepg_parse, NULL);
/* External module */
- epggrab_module_ext_create(NULL, "pyepg", "PyEPG", 4, "pyepg",
+ epggrab_module_ext_create(NULL, "pyepg", "pyepg", "PyEPG", 4, "pyepg",
_pyepg_parse, NULL);
}
void pyepg_load ( void )
{
- epggrab_module_channels_load(epggrab_module_find_by_id("pyepg"));
+ epggrab_module_channels_load("pyepg");
}
if ( outbuf[i] == '\n' || outbuf[i] == '\0' ) {
outbuf[i] = '\0';
sprintf(name, "XMLTV: %s", &outbuf[n]);
- epggrab_module_int_create(NULL, NULL, &outbuf[p], name, 3, &outbuf[p],
+ epggrab_module_int_create(NULL, NULL, &outbuf[p], "xmltv",
+ name, 3, &outbuf[p],
NULL, _xmltv_parse, NULL);
p = n = i + 1;
} else if ( outbuf[i] == '\\') {
close(rd);
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,
+ epggrab_module_int_create(NULL, NULL, bin, "xmltv", name, 3, bin,
NULL, _xmltv_parse, NULL);
free(outbuf);
} else {
void xmltv_init ( void )
{
/* External module */
- epggrab_module_ext_create(NULL, "xmltv", "XMLTV", 3, "xmltv",
+ epggrab_module_ext_create(NULL, "xmltv", "xmltv",
+ "XMLTV", 3, "xmltv",
_xmltv_parse, NULL);
/* Standard modules */
void xmltv_load ( void )
{
- epggrab_module_channels_load(epggrab_module_find_by_id("xmltv"));
+ epggrab_module_channels_load("xmltv");
}
epggrab_module_t *epggrab_module_create
( epggrab_module_t *skel, const idclass_t *cls,
- const char *id, const char *name, int priority );
+ const char *id, const char *saveid,
+ const char *name, int priority );
char *epggrab_module_grab_spawn ( void *m );
htsmsg_t *epggrab_module_trans_xml ( void *m, char *data );
void epggrab_module_parse ( void *m, htsmsg_t *data );
-void epggrab_module_channels_load ( epggrab_module_t *m );
+void epggrab_module_channels_load ( const char *modid );
/* **************************************************************************
* Channel processing
epggrab_module_int_t *epggrab_module_int_create
( epggrab_module_int_t *skel, const idclass_t *cls,
- const char *id, const char *name, int priority,
+ const char *id, const char *saveid,
+ const char *name, int priority,
const char *path,
char* (*grab) (void*m),
int (*parse) (void *m, htsmsg_t *data, epggrab_stats_t *sta),
epggrab_module_ext_t *epggrab_module_ext_create
( epggrab_module_ext_t *skel,
- const char *id, const char *name, int priority,
+ const char *id, const char *saveid,
+ 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_module_ota_t *epggrab_module_ota_create
( epggrab_module_ota_t *skel,
- const char *id, const char *name, int priority,
+ const char *id, const char *saveid,
+ const char *name, int priority,
epggrab_ota_module_ops_t *ops );
/* **************************************************************************