.ic_super = &epggrab_mod_ota_class,
.ic_class = "epggrab_mod_ota_scraper",
.ic_caption = N_("Over-the-air EPG grabber with scraping"),
+ .ic_groups = (const property_group_t[]) {
+ {
+ .name = N_("EPG behaviour"),
+ .number = 1,
+ },
+ {
+ .name = N_("Scrape behaviour"),
+ .number = 2,
+ },
+ {}
+ },
.ic_properties = (const property_t[]){
+ {
+ /* The "eit" grabber is used by a number of countries so
+ * we can't ship a config file named "eit" since regex use
+ * in the UK won't be the same as in Italy.
+ *
+ * So, this option allows the user to specify the configuration
+ * file to use from the ones that we do ship without them having
+ * to mess around in the filesystem copying files.
+ *
+ * For example they can simply specify "uk" to use its
+ * configuration file.
+ */
+ .type = PT_STR,
+ .id = "scrape_config",
+ .name = N_("Scraper configuration to use"),
+ .desc = N_("Configuration containing regular expressions to use for "
+ "scraping information from the broadcast guide. "
+ "This can be left blank to use the default or "
+ "set to one of the Tvheadend configurations from the "
+ "epggrab/eit/scrape directory such as "
+ "\"uk\" (without the quotes)."
+ ),
+ .off = offsetof(epggrab_module_ota_scraper_t, scrape_config),
+ .group = 2,
+ },
{
.type = PT_BOOL,
.id = "scrape_episode",
.name = N_("Scrape Episode"),
.desc = N_("Enable/disable scraping episode from the grabber."),
.off = offsetof(epggrab_module_ota_scraper_t, scrape_episode),
- .group = 1,
+ .group = 2,
},
{}
}
return r;
}
-static int _eit_fixup_load_one ( htsmsg_t *m, eit_module_t* mod )
+static int _eit_scrape_load_one ( htsmsg_t *m, eit_module_t* mod )
{
eit_pattern_compile_list(&mod->p_snum, htsmsg_get_list(m, "season_num"));
eit_pattern_compile_list(&mod->p_enum, htsmsg_get_list(m, "episode_num"));
return;
}
- const char config_path[] = "epggrab/eit/fixup/%s";
- const char *config_file = mod->id;
-
- /* Attempt to load config file based on grabber id such as
- * uk_freeview.
+ const char config_path[] = "epggrab/eit/scrape/%s";
+ /* Only use the user config if they have supplied one and it is not empty.
+ * Otherwise we default to using configuration based on the module
+ * name such as "uk_freeview".
*/
+ const char *config_file = mod->scrape_config && *mod->scrape_config ?
+ mod->scrape_config : mod->id;
+
+ tvhinfo(LS_TBL_EIT, "scraper %s attempt to load config \"%s\"", mod->id, config_file);
+
htsmsg_t *m = hts_settings_load(config_path, config_file);
char *generic_name = NULL;
if (!m) {
* be "uk". This allows config for a country to be shared across
* two grabbers such as DVB-T and DVB-S.
*/
- generic_name = strdup(mod->id);
+ generic_name = strdup(config_file);
if (generic_name) {
char *underscore = strstr(generic_name, "_");
if (underscore) {
}
if (m) {
- const int r = _eit_fixup_load_one(m, mod);
+ const int r = _eit_scrape_load_one(m, mod);
if (r > 0)
- tvhinfo(LS_TBL_EIT, "scraper %s loaded config %s", mod->id, config_file);
+ tvhinfo(LS_TBL_EIT, "scraper %s loaded config \"%s\"", mod->id, config_file);
else
- tvhwarn(LS_TBL_EIT, "scraper %s failed to load", mod->id);
+ tvhwarn(LS_TBL_EIT, "scraper %s failed to load config \"%s\"", mod->id, config_file);
htsmsg_destroy(m);
} else {
- tvhinfo(LS_TBL_EIT, "no scraper config files loaded for %s", mod->id);
+ tvhinfo(LS_TBL_EIT, "scraper %s no scraper config files found", mod->id);
}
if (generic_name)