scanfile: add some loading stats and warning when predefined muxes are empty

This commit is contained in:
Jaroslav Kysela 2015-02-09 22:05:23 +01:00
parent a6ac407dbf
commit f578c96949

View file

@ -681,6 +681,28 @@ scanfile_load_dir
fb_closedir(dir);
}
/*
*
*/
static int
scanfile_stats(const char *what, scanfile_region_list_t *list)
{
scanfile_region_t *reg;
scanfile_network_t *sfn;
int regions = 0, networks =0;
LIST_FOREACH(reg, list, sfr_link) {
regions++;
LIST_FOREACH(sfn, &reg->sfr_networks, sfn_link)
networks++;
}
if (regions) {
tvhinfo("scanfile", "%s - loaded %i regions with %i networks", what, regions, networks);
return 1;
}
return 0;
}
/*
* Initialise the mux list
*/
@ -688,6 +710,7 @@ void
scanfile_init ( void )
{
const char *path = config_get_muxconfpath();
int r = 0;
if (!path || !*path)
#if ENABLE_DVBSCAN
path = "data/dvb-scan";
@ -697,6 +720,17 @@ scanfile_init ( void )
path = "/usr/share/dvb";
#endif
scanfile_load_dir(path, NULL, 0);
r += scanfile_stats("DVB-T", &scanfile_regions_DVBT);
r += scanfile_stats("DVB-S", &scanfile_regions_DVBS);
r += scanfile_stats("DVB-C", &scanfile_regions_DVBC);
r += scanfile_stats("ATSC", &scanfile_regions_ATSC);
if (!r) {
tvhwarn("scanfile", "no predefined muxes found, check path '%s%s'",
path[0] == '/' ? path : TVHEADEND_DATADIR "/",
path[0] == '/' ? "" : path);
tvhwarn("scanfile", "expected tree structure - http://git.linuxtv.org/cgit.cgi/dtv-scan-tables.git/tree/");
}
}
/*