Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: Plugin specific config files
- To: vdr@linuxtv.org
- Subject: [vdr] Re: Plugin specific config files
- From: Steffen Barszus <st_barszus@gmx.de>
- Date: Tue, 2 Sep 2003 21:58:15 +0200
- Content-disposition: inline
- Content-type: text/plain; charset="iso-8859-1"
- In-reply-to: <3F520279.3298D048@cadsoft.de>
- References: <3F520279.3298D048@cadsoft.de>
- Reply-to: vdr@linuxtv.org
- Sender: vdr-bounce@linuxtv.org
- User-agent: KMail/1.5
Am Sonntag, 31. August 2003 16:13 schrieb Klaus Schmidinger:
> 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).
Ok I have tried on my own a littlebit:
plugins () {
ls $PLUGIN_CONFS 2> /dev/null > /dev/null
if test -e 0 ; then
for plugin in $(basename `ls $PLUGIN_CONFS/*.conf`) ; do {
if test -e $LIBDIR/libvdr-$plugin.so*; then
for option in `sed -e's/#.*//' -e'/^ *$/d' -e's/"/\\"/g'
"$PLUGIN_CONFS/$plugin"`; do
options="$options --$option"
done;
PLUGINS="$PLUGINS -P\"${plugin%%.conf} $options\""
fi
}
done
fi
}
with f.i. mp3.conf :
--------------------------
#mp3 (0.8.0) - A versatile audio player
#
# mount=CMD use CMD to mount/unmount/eject mp3 sources
# (default: mount.sh)
#
# network=CMD execute CMD before & after network access
# (default: none)
#
# cddb=DIR search CDDB files in DIR
# (default: /var/lib/cddb)
#network=/usr/local/bin/vdrinternet
-----------------------------------
If someone sees a possible problem here it would be nice to notify me,
i can too just use Klaus style, i just thought it is more in .conf file
style ;).
comments are welcome
Steffen
--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.
Home |
Main Index |
Thread Index