1
|
#!/bin/bash
|
2
|
|
3
|
function header {
|
4
|
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" > "$epgfile"
|
5
|
echo "<!DOCTYPE tv SYSTEM \"xmltv.dtd\">" >> "$epgfile"
|
6
|
echo '<tv generator-info-name="xmltv generator">' >> "$epgfile"
|
7
|
}
|
8
|
function footer {
|
9
|
echo '</tv>' >> "$epgfile"
|
10
|
}
|
11
|
function channel {
|
12
|
echo " <channel id=\"$channelname\">" >> "$epgfile"
|
13
|
echo " <display-name lang=\"$channellang\">$channelname</display-name>" >> "$epgfile"
|
14
|
echo " </channel>" >> "$epgfile"
|
15
|
echo "" >> "$epgfile"
|
16
|
}
|
17
|
|
18
|
function program {
|
19
|
echo " <programme start=\"$programstart\" stop=\"$programend\" channel=\"$channelname\">" >> "$epgfile"
|
20
|
echo " <title lang=\"$programlang\">$programname</title>" >> "$epgfile"
|
21
|
echo " <desc lang=\"$programlang\">" >> "$epgfile"
|
22
|
echo " $programdescription" >> "$epgfile"
|
23
|
echo " </desc>" >> "$epgfile"
|
24
|
echo " </programme>" >> "$epgfile"
|
25
|
}
|
26
|
|
27
|
epgfile="/tmp/epg.xml"
|
28
|
|
29
|
header
|
30
|
|
31
|
#Channel Section
|
32
|
#channelname should be the same in tvheadend
|
33
|
channelname="Test1 Channel"
|
34
|
channellang="de"
|
35
|
channel
|
36
|
|
37
|
channelname="Test2 Channel"
|
38
|
channellang="de"
|
39
|
channel
|
40
|
|
41
|
#Program Section
|
42
|
programname="News"
|
43
|
programdescription="Test1 Description"
|
44
|
channelname="Test1 Channel"
|
45
|
programlang="de"
|
46
|
#Time in UTC in format YYYYMMDDHHMMSS
|
47
|
programstart="201711121500"
|
48
|
programend="201711121600"
|
49
|
program
|
50
|
|
51
|
programname="Monk"
|
52
|
programdescription="Test2 Description"
|
53
|
channelname="Test2 Channel"
|
54
|
programlang="de"
|
55
|
#Time in UTC in format YYYYMMDDHHMMSS
|
56
|
programstart="201711121500"
|
57
|
programend="201711121600"
|
58
|
program
|
59
|
|
60
|
footer
|
61
|
|
62
|
# Needs User hts or root
|
63
|
cat $epgfile | socat - UNIX-CONNECT:/home/hts/.hts/tvheadend/epggrab/xmltv.sock
|