1
|
#/bin/bash
|
2
|
#m3uTOtvheadend
|
3
|
action="/mnt/action/vlc2tvheadend"
|
4
|
pfad="<folder with channel list in format .m3u or .vlc>/*" ## change <…> to your configuration
|
5
|
pfad1="<folder with channel list in format .m3u or .vlc>" ## change <…> to your configuration
|
6
|
pfad2="/home/hts/.hts/tvheadend/iptvtransports" ### change to your configuration if necessary
|
7
|
#sed s/{ctrl+v}{ctrl+m}// $pfad > $pfad.tmp001100
|
8
|
#pfad=$pfad.tmp001100
|
9
|
|
10
|
if $(test -e $action); then
|
11
|
rm $action
|
12
|
########################################################################################
|
13
|
#apt-get install tofrodos
|
14
|
#fromdos $pfad
|
15
|
#perl -p -e 's/\r$//' $pfad $pfad1/.senderl
|
16
|
#rm $pfad
|
17
|
#mv $pfad1/.senderl senderliste.vlc
|
18
|
################
|
19
|
/etc/init.d/tvheadend stop
|
20
|
echo "warte..."
|
21
|
sleep 3
|
22
|
stop tvheadend
|
23
|
echo "warte......."
|
24
|
sleep 5
|
25
|
killall tvheadend
|
26
|
echo "warte............"
|
27
|
sleep 5
|
28
|
echo "importiere neue Kanaele.."
|
29
|
|
30
|
|
31
|
cp -r -a $pfad2 $pfad1/.alt.bak
|
32
|
chown hts:share $pfad1/.alt.bak
|
33
|
rm $pfad2/*
|
34
|
|
35
|
ip=$( cat $pfad | grep @ | cut -d @ -f 2- | cut -d : -f 1-1 )
|
36
|
port=$( cat $pfad | grep @ | cut -d @ -f 2- | cut -d : -f 2-2 | sed s/{ctrl+v}{ctrl+m}// )
|
37
|
name=( $( cat $pfad | grep EXTINF | cut -d , -f 2- | tr ' ' _ ) )
|
38
|
echo ${name[0]}
|
39
|
#mkdir /home/hts/tmp
|
40
|
|
41
|
|
42
|
###################
|
43
|
typeset -i c=0
|
44
|
for i in $port
|
45
|
do
|
46
|
:
|
47
|
c=$c+1
|
48
|
echo $var
|
49
|
echo "Das ist c $c"
|
50
|
touch $pfad2/iptv_$c
|
51
|
echo \{ >> $pfad2/iptv_$c
|
52
|
echo " \"pmt\": 0," >> $pfad2/iptv_$c
|
53
|
echo " \"port\": $i," >> $pfad2/iptv_$c
|
54
|
echo " \"interface\": \"eth0\"," >> $pfad2/iptv_$c
|
55
|
done
|
56
|
######################
|
57
|
typeset -i c=0
|
58
|
for i in $ip
|
59
|
do
|
60
|
:
|
61
|
c=c+1
|
62
|
echo " \"group\": \"$i\"," >> $pfad2/iptv_$c
|
63
|
done
|
64
|
##########################
|
65
|
typeset -i c=0
|
66
|
|
67
|
for i in ${name[@]}
|
68
|
do
|
69
|
:
|
70
|
c=c+1
|
71
|
var=$(echo $i | tr _ ' ')
|
72
|
echo " \"channelname\": \"$var\"," >> $pfad2/iptv_$c
|
73
|
echo " \"mapped\": 1," >> $pfad2/iptv_$c
|
74
|
echo " \"pcr\": 0," >> $pfad2/iptv_$c
|
75
|
echo " \"disabled\": 0" >> $pfad2/iptv_$c
|
76
|
echo \} >> $pfad2/iptv_$c
|
77
|
sed "s/\^M//" -i $pfad2/iptv_$c
|
78
|
done
|
79
|
rm $pfad
|
80
|
#######################
|
81
|
chown hts:hts $pfad2/*
|
82
|
/etc/init.d/tvheadend start
|
83
|
sleep 3
|
84
|
start tvheadend
|
85
|
########################################################################################
|
86
|
else echo "No new channel list, exiting..";
|
87
|
fi
|