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
|
<?php
/*
Types:
none : Not running
tv : VDR live
rec : VDR recording
vid : Media
*/
function writeinfostream($session, $type, $mode, $url, $channame)
{
addlog("Writting stream info from session " .$session ." (type=" .$type .", mode=" .$mode .", url=" .$url .", channame=" .$channame .")");
$ram = "../ram/" .$session ."/";
$infofile = @fopen($ram ."streaminfo", 'w');
if (!$infofile)
return;
fwrite($infofile, "type=" .$type ."\n");
fwrite($infofile, "mode=" .$mode ."\n");
fwrite($infofile, "url=" .$url ."\n");
fwrite($infofile, "channame=" .$channame ."\n");
fclose($infofile);
}
function readinfostream($session)
{
$ram = "../ram/" .$session ."/";
if (!file_exists($ram ."streaminfo"))
return array("none");
$infofile = @fopen($ram ."streaminfo", 'r');
if (!$infofile)
return array("none");
while ($line = fgets($infofile, 1024))
{
if (!strncmp($line, "type=", strlen("type=")))
$type = substr($line, strlen("type="), -1);
else if (!strncmp($line, "mode=", strlen("mode=")))
$mode = substr($line, strlen("mode="), -1);
else if (!strncmp($line, "url=", strlen("url=")))
$url = substr($line, strlen("url="), -1);
else if (!strncmp($line, "channame=", strlen("channame=")))
$channame = substr($line, strlen("channame="), -1);
}
fclose($infofile);
return array($type, $mode, $url, $channame);
}
?>
|