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
|
<?php
/*
Types:
0 : Not running
1 : VDR live
2 : VDR recording
3 : Media
*/
function writeinfostream($session, $type=0, $name="", $title="", $desc="", $mode="", $category="", $url="", $mediapath="", $subdir="")
{
$ram = "ram/" .$session ."/";
$infofile = fopen($ram ."streaminfo", 'w');
fwrite($infofile, "type=" .$type ."\n");
fwrite($infofile, "name=" .$name ."\n");
fwrite($infofile, "title=" .$title ."\n");
fwrite($infofile, "desc=" .$desc ."\n");
fwrite($infofile, "mode=" .$mode ."\n");
fwrite($infofile, "category=" .$category ."\n");
fwrite($infofile, "url=" .$url ."\n");
fwrite($infofile, "mediapath=" .$mediapath ."\n");
fwrite($infofile, "subdir=" .$subdir ."\n");
fclose($infofile);
}
function readinfostream($session)
{
$ram = "ram/" .$session ."/";
if (!file_exists($ram ."streaminfo"))
return array(0, "", "", "", "");
$infofile = fopen($ram ."streaminfo", 'r');
if (!$infofile)
return array(0, "", "", "", "");
while ($line = fgets($infofile, 1024))
{
if (!strncmp($line, "type=", strlen("type=")))
$type = substr($line, strlen("type="), -1);
else if (!strncmp($line, "name=", strlen("name=")))
$name = substr($line, strlen("name="), -1);
else if (!strncmp($line, "title=", strlen("title=")))
$title = substr($line, strlen("title="), -1);
else if (!strncmp($line, "desc=", strlen("desc=")))
$desc = substr($line, strlen("desc="), -1);
else if (!strncmp($line, "mode=", strlen("mode=")))
$mode = substr($line, strlen("mode="), -1);
else if (!strncmp($line, "category=", strlen("category=")))
$category = substr($line, strlen("category="), -1);
else if (!strncmp($line, "url=", strlen("url=")))
$url = substr($line, strlen("url="), -1);
else if (!strncmp($line, "mediapath=", strlen("mediapath=")))
$mediapath = substr($line, strlen("mediapath="), -1);
else if (!strncmp($line, "subdir=", strlen("subdir=")))
$subdir = substr($line, strlen("subdir="), -1);
}
fclose($infofile);
return array($type, $name, $title, $desc, $mode, $category, $url, $mediapath, $subdir);
}
?>
|