diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2011-03-26 18:20:11 +0200 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2011-03-27 11:00:06 +0300 |
commit | f33956dc7d8a0d9c2bcdbc705143231eb885cd89 (patch) | |
tree | ea7b660269c82d69ddcd8723e94f5bbe6a3a3c13 | |
parent | e4990a7519817dc2d90e1e9bb5c27ecbad4f8f5f (diff) | |
download | vdr-plugin-webvideo-f33956dc7d8a0d9c2bcdbc705143231eb885cd89.tar.gz vdr-plugin-webvideo-f33956dc7d8a0d9c2bcdbc705143231eb885cd89.tar.bz2 |
vfat and verbose config file options
-rw-r--r-- | src/vdr-plugin/config.c | 21 | ||||
-rw-r--r-- | src/webvicli/webvicli/client.py | 19 |
2 files changed, 38 insertions, 2 deletions
diff --git a/src/vdr-plugin/config.c b/src/vdr-plugin/config.c index 8bc3fde..1fa62c8 100644 --- a/src/vdr-plugin/config.c +++ b/src/vdr-plugin/config.c @@ -118,6 +118,27 @@ bool cWebvideoConfig::ReadConfigFile(const char *inifile) { SetTemplatePath(templatepath); } + const char *vfat = iniparser_getstring(conf, "webvi:vfat", NULL); + if (vfat) { + debug("vfat = %s (from %s)", vfat, inifile); + + if (strcmp(vfat, "1") == 0 || + strcmp(vfat, "true") == 0 || + strcmp(vfat, "yes") == 0 || + strcmp(vfat, "on") == 0) + { + vfatNames = true; + } else if (strcmp(vfat, "0") == 0 || + strcmp(vfat, "false") == 0 || + strcmp(vfat, "no") == 0 || + strcmp(vfat, "off") == 0) + { + vfatNames = false; + } else { + warning("Invalid value for config option vfat: %s in %s", vfat, inifile); + } + } + for (int i=0; i<iniparser_getnsec(conf); i++) { const char *section = iniparser_getsecname(conf, i); diff --git a/src/webvicli/webvicli/client.py b/src/webvicli/webvicli/client.py index a8fd6d7..daefa6d 100644 --- a/src/webvicli/webvicli/client.py +++ b/src/webvicli/webvicli/client.py @@ -698,7 +698,21 @@ def load_config(options): for sec in cfgprs.sections(): if sec == 'webvi': for opt, val in cfgprs.items('webvi'): - options[opt] = val + if opt in ['vfat', 'verbose']: + try: + options[opt] = cfgprs.getboolean(sec, opt) + except ValueError: + print 'Invalid config: %s = %s' % (opt, val) + + # convert verbose to integer + if opt == 'verbose': + if options['verbose']: + options['verbose'] = 1 + else: + options['verbose'] = 0 + + else: + options[opt] = val else: sitename = urlparse(sec).netloc @@ -741,7 +755,8 @@ def parse_command_line(cmdlineargs, options): options['templatepath'] = cmdlineopt.templatepath if cmdlineopt.verbose > 0: options['verbose'] = cmdlineopt.verbose - options['vfat'] = cmdlineopt.vfat + if cmdlineopt.vfat: + options['vfat'] = cmdlineopt.vfat return options |