Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Plugin specific config files



There was a rather hot discussion about whether there should be
separate config files for each VDR plugin in the thread with
the subject "Problems with exit-states (VDR-1.2.2)". As it turned out
there seems to be a problem with long options not being handled correctly.
That problem will be handled further in the above mentioned thread.

However, just in case somebody is interested, I hacked together
a small shell script that could be used to implement plugin
specific config files right away. The script assumes that all
plugin config files are located in a given directory and are named
"*.conf" (where '*' is any name, supposedly the name of the plugin
this file is for).

The syntax of the conf files is simple:

- everything after (and including) a '#' is comment and will be stripped
- empty lines are ignored
- the first non empty (non comment) line must contain the plugin name
- the following lines shall contain plugin options in exactly
  the form they would be given in the command line

Here's an example with two config files:

--- aaa.conf ----------- cut here -----------------------
# Plugin configuration file for VDR

aaa  # the name of the plugin

--param1=123   # the first parameter
--param2=456   # the second parameter
-t             # a short parameter w/o value

# --test       # a parameter has been commented out
--- aaa.conf ----------- cut here -----------------------

--- bbb.conf ----------- cut here -----------------------
# Plugin configuration file for VDR

bbb  # the name of the plugin

--param1=abc   # the first parameter
--param2="de f"# the second parameter, with a blank
-s             # a short parameter w/o value

# --retry      # a parameter has been commented out
--- bbb.conf ----------- cut here -----------------------

And finally the script:

------------------------ cut here -----------------------
#!/bin/sh

CONFDIR="."   # path to your plugin config directory
VDROPTS=""    # set your VDR options here

OPTIONS=$(
     for i in $CONFDIR/*.conf; do
         echo $(
              echo -n '-P"'
              sed -e's/#.*//' -e'/^ *$/d' -e's/"/\\"/g' $i
              echo '"'
              )
         done
     )
     
echo vdr $VDROPTS $OPTIONS
------------------------ cut here -----------------------

As it is, it just echos the command it would normally execute,
which with the above examples is

vdr -P"aaa --param1=123 --param2=456 -t " -P"bbb --param1=abc --param2=\"de f\" -s "


Maybe you guys already have much more sophisticated stuff.
I just thought I'd drop this one in, just in case somebody
is interested in a simple but maybe efficient method.
This makes it possible to have separate, commented config files
for each plugin, and also allows adding plugins by simply
putting the respective conf file into the config directory - or
removing them by removing or renaming the respective file(s).

Klaus


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index