diff options
author | Lars Hanisch <dvb@flensrocker.de> | 2010-03-31 20:48:53 +0200 |
---|---|---|
committer | Lars Hanisch <dvb@flensrocker.de> | 2010-03-31 20:48:53 +0200 |
commit | a3b3224c843948bde26c7335755fa5468e97de42 (patch) | |
tree | b24e7100873b756d27fe44d498c20f6aa7f6a068 /example | |
parent | b1a8945b1951c5e6b2f25c2781ecb9f77b26158c (diff) | |
download | vdr-plugin-pvrinput-a3b3224c843948bde26c7335755fa5468e97de42.tar.gz vdr-plugin-pvrinput-a3b3224c843948bde26c7335755fa5468e97de42.tar.bz2 |
add new conversion-script for channels.conf
Converts the plugin-param-patch-syntax channels.conf to the new
syntax used by vdr >= 1.7.13
Diffstat (limited to 'example')
-rwxr-xr-x | example/channel-conv2.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/example/channel-conv2.sh b/example/channel-conv2.sh new file mode 100755 index 0000000..a0225bf --- /dev/null +++ b/example/channel-conv2.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# converts "old" syntax used by vdr with plugin-param-patch +# to new syntax needed for vdr >= 1.7.13 +# based on channel-conv.sh by wirbel +# --mini73 20100331 + +if [ -z "$2" ] # expecting two args +then + echo "Usage: `basename $0` channels.conf.old channels.conf" + echo " " + echo "converts existing pvrinput channels.conf (plugin-param-patch) to brand new channels.conf syntax (vdr >= 1.7.13)." + echo " * first arg is path to old channels.conf" + echo " * second arg is path to new channels.conf" + echo " " + echo "-- MISSING ARGUMENTS. EXITING NOW. --" + exit -1 +else + OLDFILE=$1 + NEWFILE=$2 +fi + +while IFS=: read name freq param source srate vpid apid tpid caid sid nid tid rid +do + if [ -z "$name" ]; then + echo ":"$freq"" >> $NEWFILE + continue + fi + + # split param at first | + pluginname=${param%%|*} + newparam=${param#*|} + + if [[ "$source" == "P" ]] && [[ "$pluginname" == "PVRINPUT" ]]; then + # split vpid in vpid, pcrpid and streamtype + vpcrpid=${vpid%%=*} + vtype=${vpid#*=} + realvpid=${vpcrpid%%+*} + pcrpid=${vpcrpid#*+} + if [[ -z "$vtype" ]]; then + vtype=2 + fi + if [[ -z "$pcrpid" ]]; then + pcrpid=101 + fi + + # if current sid is already 1 keep old tid + if [[ "$sid" == "1" ]]; then + sid=$tid + fi + + # omit PVRINPUT from parameter, set source to V, set SID to 1 and old SID to TID + echo "$name:$freq:$newparam:V:$srate:$realvpid+$pcrpid=$vtype:$apid:$tpid:$caid:1:$nid:$sid:$rid" >> $NEWFILE + else + # non-pvrinput channel; copy n paste it + echo "$name:$freq:$param:$source:$srate:$vpid:$apid:$tpid:$caid:$sid:$nid:$tid:$rid" >> $NEWFILE + fi +done < $OLDFILE # I/O redirection. + |