blob: 1c39a5498a93b19eeff0f9d4ff4a5f6d9393a191 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/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
if [[ `expr index "$newparam" "RADIO"` -eq 1 ]]; then
newvpid=$vpid
else
# split vpid in vpid, pcrpid and streamtype
if [[ `expr index "$vpid" "="` -gt 0 ]]; then
vpcrpid=${vpid%%=*}
vtype=${vpid#*=}
else
vpcrpid=$vpid
vtype=2
fi
if [[ `expr index "$vpcrpid" "\+"` -gt 0 ]]; then
realvpid=${vpcrpid%%+*}
pcrpid=${vpcrpid#*+}
else
realvpid=$vpcrpid
pcrpid=101
fi
newvpid=$realvpid+$pcrpid=$vtype
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:$newvpid:$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.
|