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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
<?php
function getGlobals()
{
global $vdrstreamdev, $vdrrecpath, $mediasource, $videosource, $audiosource;
$ret = array();
$ret['streamdev_server'] = $vdrstreamdev;
$ret['rec_path'] = $vdrrecpath;
$ret['video_path'] = $videosource;
$ret['audio_path'] = $audiosource;
return json_encode($ret);
}
function getTvCat()
{
$ret = array();
$ret['categories'] = vdrgetcategories();
return json_encode($ret);
}
function getFullChanList()
{
$catlist = array();
// Get all categories
$categories = vdrgetcategories();
// For all categories
$count = count($categories);
for ($i = 0; $i < $count; $i++)
{
$tmpcat = array();
$tmpcat['name'] = $categories[$i]['name'];
$tmpcat['channel'] = vdrgetchannels($tmpcat['name'], 0);
$catlist[] = $tmpcat;
}
$ret = array();
$ret['category'] = $catlist;
return json_encode($ret);
}
function getTvChan($cat)
{
$ret = array();
$ret['channel'] = vdrgetchannels($cat, 1);
return json_encode($ret);
}
function getChanInfo($channum)
{
$ret = array();
$ret['program'] = vdrgetchaninfo($channum);
return json_encode($ret);
}
function getRecInfo($rec)
{
$ret = array();
$info = array();
list($info['channel'], $info['name'], $info['desc'], $info['recorded']) = vdrgetrecinfo($rec);
$ret['program'] = $info;
return json_encode($ret);
}
function getVidInfo($file)
{
$ret = array();
// Generate logo
generatelogo('vid', $file, '../ram/temp-logo.png');
$ret['program'] = mediagetinfostream($file);
return json_encode($ret);
}
function startBroadcast($type, $url, $mode)
{
$ret = array();
$ret['session'] = substr(sessioncreate($type, $url, $mode), strlen("session"));
return json_encode($ret);
}
function stopBroadcast($session)
{
$ret = array();
if ($session == "all")
$ret = sessiondelete($session);
else
$ret = sessiondelete("session" .$session);
return json_encode($ret);
}
function getStreamInfo($session)
{
$ret = array();
$info = sessiongetinfo("session" .$session);
$info['session'] = substr($info['session'], strlen("session"));
$ret['stream'] = $info;
return json_encode($ret);
}
function getStreamStatus($session)
{
$ret = sessiongetstatus("session" .$session);
return json_encode($ret);
}
function getTimers()
{
$ret = array();
$ret['timer'] = vdrlisttimers();
return json_encode($ret);
}
function delTimer($id)
{
$ret = vdrdeltimer($id);
return json_encode($ret);
}
function editTimer($id, $name, $active, $channumber, $date, $starttime, $endtime)
{
$ret = vdrsettimer($id, $channumber, $date, $starttime, $endtime, $name, $active);
return json_encode($ret);
}
function getRunningSessions()
{
$ret = array();
$ret['broadcast'] = sessiongetlist();
return json_encode($ret);
}
function browseFolder($path)
{
$ret = array();
$ret['list'] = filesgetlisting($path);
return json_encode($ret);
}
function streamAudio($path, $file)
{
$ret = array();
$ret['track'] = streammusic($path, $file);
return json_encode($ret);
}
?>
|