summaryrefslogtreecommitdiff
path: root/includes/inc_stream.php
blob: d6297e081146454f6ba853d26faedd0108dadc52 (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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php

global $vdrstreamdev, $quality;

// Check if we are running
if (infostreamexist())
{
	// Get current stream info
	list($type, $realname, $title, $desc, $mode, $category, $url, $mediapath, $subdir) = readinfostream();

	print "<body onorientationchange=\"updateOrientation();\" onload=\"ajax();\">\r\n";
	
	print "<div id=\"topbar\" class=\"transparent\">\r\n";
	print "<div id=\"leftnav\">\r\n";
	print "<a href=\"javascript:sendForm('stopstream');\">Stop Stream</a></div>\r\n";
	print "<div id=\"title\">iStreamdev</div>\r\n";
	print "</div>\r\n";

	print "<div id=\"content\">\r\n";
        print " <span class=\"graytitle\">Now streaming</span>\r\n";

	// Print the right logo
	print " <ul class=\"pageitem\">\r\n";

	switch ($type)
	{
		case 1:
			$channoslash = preg_replace("$/$", " ", $realname);
			$logopath = "logos/" .$channoslash .".png";
			if (!file_exists($logopath))
				$logopath = "logos/nologoTV.png";
			break;
		case 2:
			$channoslash = preg_replace("$/$", " ", $realname);
			$logopath = "logos/" .$channslash .".png";
			if (!file_exists($logopath))
				$logopath = "logos/nologoREC.png";
			break;
		case 3:
		        if (file_exists("ram/stream-tb.png"))
		                $logopath = "ram/stream-tb.png";
		        else if (file_exists("ram/stream-tb.jpg"))
		                $logopath = "ram/stream-tb.jpg";
		        else
		                $logopath = "logos/nologoMEDIA.png";
	}

	print " <center><video id=\"videofeed\" poster=\"{$logopath}\" /></center>\r\n";

	print " </ul>\r\n";

	print " <ul class=\"pageitem\">\r\n";
	print " <li class=\"textbox\"><span class=\"header\">{$realname}</span><p><strong>{$title}</strong>\r\n";
	print " <br>{$desc}</p></li></ul>\r\n";
	
	print " <ul class=\"pageitem\">\r\n";
	print " <li id=\"modetext\" class=\"textbox\"><span class=\"header\">Mode</span>\r\n";
	print " <p id='streamtitle'>{$mode}</p></li></ul>\r\n";

	print " </div>\r\n";

	print " <form name=\"stopstream\" id=\"stopstream\" method=\"post\" action=\"index.php\">";
	print "    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stopstream\" />";
	print "    <input name=\"actionafterstop\" type=\"hidden\" id=\"actionafterstop\" value=\"stream\" />";
	print "    <input name=\"type\" type=\"hidden\" id=\"type\" value={$type} />";
	switch ($type)
	{
		case 1:
			print "   <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />";
			break;
		case 3:
			print "    <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n";
			print "    <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n";
			// NO BREAK
		case 2:	
			print "   <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$url}\" />";
			break;
			
	}
	print " </form>\r\n";
}
else
{
	$category = $_SESSION['currentcat'];

        $type = $_REQUEST['type'];
	$name = $_REQUEST['name'];

	switch ($type)
	{
		// Live TV
		case 1:
			list($title, $desc, $realname) = vdrgetinfostream($name, 1);
			$channum = vdrgetchannum($realname);
			break;
		// Recording
		case 2:
			list($title, $desc, $realname) = vdrgetinfostream($name, 0);
			break;
		// Media
		case 3:
			list($title, $desc) = mediagetinfostream($name);
			$realname = basename($name);
			break;
		default:
			$realname = "";
			$title = "";
			$desc = "";
			$channame = "";
	}

	print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n";

	print "<div id=\"topbar\" class=\"transparent\">\r\n";
	print "<div id=\"leftnav\">\r\n";

	print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n";
	print "<div id=\"rightnav\">\r\n";
	print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n";

	print "<div id=\"title\">iStreamdev</div>\r\n";
	print "</div>\r\n";

	print "<div id=\"content\">\r\n";

	print " <span class=\"graytitle\">Select stream mode</span>\r\n";

	// Print the right logo
	print " <ul class=\"pageitem\">\r\n";

        switch ($type)
        {
                case 1:
			$channoslash = preg_replace("$/$", " ", $realname);
                        $logopath = "logos/" .$channoslash .".png";
                        if (!file_exists($logopath))
                                $logopath = "logos/nologoTV.png";
                        break;
                case 2:
			$channoslash = preg_replace("$/$", " ", $realname);
                        $logopath = "logos/" .$channoslash .".png";
                        if (!file_exists($logopath))
                                $logopath = "logos/nologoREC.png";
                        break;
                case 3:
                        if (file_exists("ram/stream-tb.png"))
                                $logopath = "ram/stream-tb.png";
                        else if (file_exists("ram/stream-tb.jpg"))
                                $logopath = "ram/stream-tb.jpg";
                        else
                                $logopath = "logos/nologoMEDIA.png";
        }

	print " <center><img src=\"{$logopath}\"></img></center>\r\n";

	print " </ul>\r\n";

	// Check if running to display the start buttons
	print " <div id=\"tributton\">\r\n";
	print "         <div class=\"links\">\r\n";

	foreach ($quality as $qname => $qparams)
		print "<a href=\"javascript:sendForm('$qname')\">{$qname}</a>";
	print "\r\n";

	print " </div></div>\r\n";

	print " <ul class=\"pageitem\">\r\n";
	print " <li class=\"textbox\"><span class=\"header\">{$realname}</span><p><strong>{$title}</strong>\r\n";
	print " <br>{$desc}</p></li></ul>\r\n";

	print " </div>\r\n";

	foreach ($quality as $qname => $qparams)
	{
		print "  <form name=\"{$qname}\" id=\"{$qname}\" method=\"post\" action=\"index.php\">\r\n";
		print "    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"startstream\" />\r\n";
		print "    <input name=\"type\" type=\"hidden\" id=\"type\" value={$type} />\r\n";
		print "    <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$realname}\" />\r\n";
		print "    <input name=\"title\" type=\"hidden\" id=\"title\" value=\"{$title}\" />\r\n";
		print "    <input name=\"desc\" type=\"hidden\" id=\"desc\" value=\"{$desc}\" />\r\n";
		print "    <input name=\"qname\" type=\"hidden\" id=\"qname\" value=\"{$qname}\" />\r\n";
		print "    <input name=\"qparams\" type=\"hidden\" id=\"qparams\" value=\"{$qparams}\" />\r\n";
		print "    <input name=\"category\" type=\"hidden\" id=\"category\" value=\"{$category}\" />\r\n";
		switch ($type)
		{
			case 1:
				print "    <input name=\"url\" type=\"hidden\" id=\"url\" value=\"{$vdrstreamdev}{$channum}\" />\r\n";
				break;
			case 3:
				$mediapath = $_REQUEST['mediapath'];
				$subdir = $_REQUEST['subdir'];
				print "    <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n";
				print "    <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n";
				// NO BREAK
			case 2:
				print "    <input name=\"url\" type=\"hidden\" id=\"url\" value=\"{$name}\" />\r\n";
                                break;
		}
		print "  </form>";
	}

	print "  <form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">";
        switch ($type)
        {
                case 1:
			print "    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"listchannels\" />";
                        print "    <input name=\"cat\"type=\"hidden\" id=\"cat\" value=\"{$category}\" />";
                        break;
                case 2:
			$dir = dirname($name);
			print "    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"recordings\" />";
                        print "    <input name=\"dir\"type=\"hidden\" id=\"dir\" value=\"{$dir}\" />";
                        break;
		case 3:
			$mediapath = $_REQUEST['mediapath'];
			$subdir = $_REQUEST['subdir'];
			print "    <input name=\"action\" type=\"hidden\" id=\"action\" value=\"video\" />";
			print "    <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n";
			print "    <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n";
                        break;
        }
        print "  </form>\r\n";

}

?>