- [EPG Grabber](class/epggrab)
- EPG Grabber Modules
- [OTA Module](class/epggrab_mod_ota)
- - [Internal Module](class/epggrab_mod_int)
- - [External Module](class/epggrab_mod_ext)
+ - [Internal PyEPG](class/epggrab_mod_int_pyepg)
+ - [Internal XMLTV](class/epggrab_mod_int_xmltv)
+ - [External PyEPG](class/epggrab_mod_ext_pyepg)
+ - [External XMLTV](class/epggrab_mod_ext_xmltv)
* Stream
idclass_register(&epggrab_class);
idclass_register(&epggrab_mod_class);
idclass_register(&epggrab_mod_int_class);
+ idclass_register(&epggrab_mod_int_pyepg_class);
+ idclass_register(&epggrab_mod_int_xmltv_class);
idclass_register(&epggrab_mod_ext_class);
+ idclass_register(&epggrab_mod_ext_pyepg_class);
+ idclass_register(&epggrab_mod_ext_xmltv_class);
idclass_register(&epggrab_mod_ota_class);
epggrab_channel_init();
const char *path; ///< Path for the command
const char *args; ///< Extra arguments
+ int xmltv_chnum;
+
/* Handle data */
char* (*grab) ( void *mod );
htsmsg_t* (*trans) ( void *mod, char *data );
* Create a module
*/
epggrab_module_ext_t *epggrab_module_ext_create
- ( epggrab_module_ext_t *skel,
+ ( epggrab_module_ext_t *skel, const idclass_t *cls,
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),
/* Pass through */
hts_settings_buildpath(path, sizeof(path), "epggrab/%s.sock", sockid);
epggrab_module_int_create((epggrab_module_int_t*)skel,
- &epggrab_mod_ext_class,
+ cls ?: &epggrab_mod_ext_class,
id, saveid, name, priority, path,
NULL, parse, trans);
* Module Setup
* ***********************************************************************/
+const idclass_t epggrab_mod_int_pyepg_class = {
+ .ic_super = &epggrab_mod_int_class,
+ .ic_class = "epggrab_mod_int_pyepg",
+ .ic_caption = N_("Internal PyEPG grabber"),
+};
+
+
+const idclass_t epggrab_mod_ext_pyepg_class = {
+ .ic_super = &epggrab_mod_ext_class,
+ .ic_class = "epggrab_mod_ext_pyepg",
+ .ic_caption = N_("External PyEPG grabber"),
+};
+
+
void pyepg_init ( void )
{
char buf[256];
/* Internal module */
if (find_exec("pyepg", buf, sizeof(buf)-1))
- epggrab_module_int_create(NULL, NULL,
+ epggrab_module_int_create(NULL, &epggrab_mod_int_pyepg_class,
"pyepg-internal", "pyepg", "PyEPG", 4, buf,
NULL, _pyepg_parse, NULL);
/* External module */
- epggrab_module_ext_create(NULL, "pyepg", "pyepg", "PyEPG", 4, "pyepg",
+ epggrab_module_ext_create(NULL, &epggrab_mod_ext_pyepg_class,
+ "pyepg", "pyepg", "PyEPG", 4, "pyepg",
_pyepg_parse, NULL);
}
int n = 0;
name = htsmsg_get_str(subtag, "cdata");
- while (isdigit(*(name + n))) n++;
- if (n > 0) {
- if (*(name + n) == 0 || *(name + n) == ' ') {
- save |= epggrab_channel_set_number(ch, atoi(name), 0);
- name += n;
- while (*name == ' ') name++;
+ if (((epggrab_module_ext_t *)mod)->xmltv_chnum) {
+ while (isdigit(*(name + n))) n++;
+ if (n > 0) {
+ if (*(name + n) == 0 || *(name + n) == ' ') {
+ save |= epggrab_channel_set_number(ch, atoi(name), 0);
+ name += n;
+ while (*name == ' ') name++;
+ }
}
}
if (*name)
* Module Setup
* ***********************************************************************/
+#define DN_CHNUM_NAME N_("Channel numbers (heuristic)")
+#define DN_CHNUM_DESC \
+ N_("Try to obtain channel numbers from the display-name xml tag. " \
+ "If the first word is number, it is used as the channel number.")
+
+const idclass_t epggrab_mod_int_xmltv_class = {
+ .ic_super = &epggrab_mod_int_class,
+ .ic_class = "epggrab_mod_int_xmltv",
+ .ic_caption = N_("Internal XMLTV EPG grabber"),
+ .ic_properties = (const property_t[]){
+ {
+ .type = PT_BOOL,
+ .id = "dn_chnum",
+ .name = DN_CHNUM_NAME,
+ .desc = DN_CHNUM_DESC,
+ .off = offsetof(epggrab_module_int_t, xmltv_chnum),
+ .group = 1
+ },
+ {}
+ }
+};
+
+const idclass_t epggrab_mod_ext_xmltv_class = {
+ .ic_super = &epggrab_mod_ext_class,
+ .ic_class = "epggrab_mod_ext_xmltv",
+ .ic_caption = N_("External XMLTV EPG grabber"),
+ .ic_properties = (const property_t[]){
+ {
+ .type = PT_BOOL,
+ .id = "dn_chnum",
+ .name = DN_CHNUM_NAME,
+ .desc = DN_CHNUM_DESC,
+ .off = offsetof(epggrab_module_ext_t, xmltv_chnum),
+ .group = 1
+ },
+ {}
+ }
+};
+
static void _xmltv_load_grabbers ( void )
{
int outlen = -1, rd = -1;
if ( outbuf[i] == '\n' || outbuf[i] == '\0' ) {
outbuf[i] = '\0';
sprintf(name, "XMLTV: %s", &outbuf[n]);
- epggrab_module_int_create(NULL, NULL, &outbuf[p], "xmltv",
+ epggrab_module_int_create(NULL, &epggrab_mod_int_xmltv_class,
+ &outbuf[p], "xmltv",
name, 3, &outbuf[p],
NULL, _xmltv_parse, NULL);
p = n = i + 1;
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, "xmltv", name, 3, bin,
+ epggrab_module_int_create(NULL, &epggrab_mod_int_xmltv_class,
+ 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",
- "XMLTV", 3, "xmltv",
+ epggrab_module_ext_create(NULL, &epggrab_mod_ext_xmltv_class,
+ "xmltv", "xmltv", "XMLTV", 3, "xmltv",
_xmltv_parse, NULL);
/* Standard modules */
* *************************************************************************/
epggrab_module_ext_t *epggrab_module_ext_create
- ( epggrab_module_ext_t *skel,
+ ( epggrab_module_ext_t *skel, const idclass_t *cls,
const char *id, const char *saveid,
const char *name, int priority,
const char *sockid,
extern const idclass_t epggrab_mod_class;
extern const idclass_t epggrab_mod_int_class;
+extern const idclass_t epggrab_mod_int_pyepg_class;
+extern const idclass_t epggrab_mod_int_xmltv_class;
extern const idclass_t epggrab_mod_ext_class;
+extern const idclass_t epggrab_mod_ext_pyepg_class;
+extern const idclass_t epggrab_mod_ext_xmltv_class;
extern const idclass_t epggrab_mod_ota_class;
/* **************************************************************************