1
|
#!/bin/bash
|
2
|
|
3
|
function header {
|
4
|
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > "$epgfilename"
|
5
|
echo "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">" >> "$epgfilename"
|
6
|
echo '<tv generator-info-name="mytrils xmltv generator">' >> "$epgfilename"
|
7
|
}
|
8
|
function footer {
|
9
|
echo '</tv>' >> "$epgfilename"
|
10
|
}
|
11
|
function channel {
|
12
|
channelname=${channelname//&/und}
|
13
|
echo " <channel id=\"$channelname\">" >> "$epgfilename"
|
14
|
echo " <display-name lang=\"$channellang\">$channelname</display-name>" >> "$epgfilename"
|
15
|
echo " </channel>" >> "$epgfilename"
|
16
|
echo "" >> "$epgfilename"
|
17
|
}
|
18
|
|
19
|
function program {
|
20
|
channelname=${channelname//&/und}
|
21
|
echo " <programme start=\"$programstart\" stop=\"$programend\" channel=\"$channelname\">" >> "$epgfilename"
|
22
|
programname=${programname//&/und}
|
23
|
echo " <title lang=\"$programlang\">$programname</title>" >> "$epgfilename"
|
24
|
echo " <desc lang=\"$programlang\">" >> "$epgfilename"
|
25
|
programdescription=${programdescription//&/und}
|
26
|
echo " $programdescription" >> "$epgfilename"
|
27
|
echo " </desc>" >> "$epgfilename"
|
28
|
echo " </programme>" >> "$epgfilename"
|
29
|
}
|
30
|
|
31
|
# Begin Edit
|
32
|
epgfilename="epg.xml"
|
33
|
moviefolder="Path to moviefolder without / at end"
|
34
|
moviefilename="Name of movie file.mkv"
|
35
|
|
36
|
httpport="9002"
|
37
|
httpmuxname="muxname.ts"
|
38
|
|
39
|
cd "$moviefolder"
|
40
|
rm "$epgfilename"
|
41
|
|
42
|
header
|
43
|
|
44
|
channelname="Channel"
|
45
|
channellang="de"
|
46
|
# End Edit
|
47
|
channel
|
48
|
|
49
|
currentTime=$(date -u +'%Y-%m-%d %H:%M:%S')
|
50
|
|
51
|
cat "${moviefilename%.*}"".txt" | while read line; do
|
52
|
hours=$(echo "$line" | cut -d ':' -f 1)
|
53
|
minutes=$(echo "$line" | cut -d ':' -f 2)
|
54
|
seconds=$(echo "$line" | cut -d ':' -f 3)
|
55
|
filename=$(echo "$line" | cut -d ':' -f 4)
|
56
|
programname="${filename%.*}"
|
57
|
programdescription="${filename%.*}"
|
58
|
programlang="de"
|
59
|
|
60
|
programstart="$(date -d "$currentTime" +'%Y%m%d%H%M%S')"
|
61
|
currentTime=$(date -d "$currentTime $hours hours $minutes minutes $seconds seconds" +'%Y-%m-%d %H:%M:%S')
|
62
|
#echo "$currentTime"
|
63
|
programend="$(date -d "$currentTime" +'%Y%m%d%H%M%S')"
|
64
|
program
|
65
|
done
|
66
|
|
67
|
# programname="News"
|
68
|
# programdescription="How I met your Mother Description"
|
69
|
# channelname="How I met your Mother Channel"
|
70
|
# programlang="de"
|
71
|
# programstart="201711121500"
|
72
|
# programend="201711121600"
|
73
|
# program
|
74
|
|
75
|
footer
|
76
|
|
77
|
# Needs User hts or root
|
78
|
cat "$epgfilename" | socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock
|
79
|
#sleep 5s
|
80
|
cvlc --no-loop --no-repeat --play-and-exit "$moviefolder""/""$moviefilename" --sout "#gather:std{access=http,mux=ts,dst=:""$httpport""/""$httpmuxname""}" --sout-keep
|
81
|
echo "Ende"
|
82
|
#rm "$epgfilename"
|