summaryrefslogtreecommitdiff
path: root/bin/streaminfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'bin/streaminfo.php')
-rwxr-xr-xbin/streaminfo.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/bin/streaminfo.php b/bin/streaminfo.php
new file mode 100755
index 0000000..f102226
--- /dev/null
+++ b/bin/streaminfo.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+ Types:
+ 0 : Not running
+ tv : VDR live
+ rec : VDR recording
+ vid : Media
+*/
+
+function writeinfostream($session, $type, $mode, $url, $channame)
+{
+ $ram = "../ram/" .$session ."/";
+
+ $infofile = fopen($ram ."streaminfo", 'w');
+
+ 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(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, "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);
+}
+
+?>