summaryrefslogtreecommitdiff
path: root/bin/backend.php
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-03-17 14:06:08 +0100
committerTheTroll <trolldev@gmail.com>2010-03-17 14:06:08 +0100
commit737a6402836788d359fcd99bef93ae059c085577 (patch)
tree2cb70992cf1fe452ebec552970b49e5a31cfb712 /bin/backend.php
parent4e2acf476cadde8495ff3cf484a866fe8d0ba8ec (diff)
downloadistreamdev-737a6402836788d359fcd99bef93ae059c085577.tar.gz
istreamdev-737a6402836788d359fcd99bef93ae059c085577.tar.bz2
Session start/stop implemented
Diffstat (limited to 'bin/backend.php')
-rwxr-xr-xbin/backend.php48
1 files changed, 22 insertions, 26 deletions
diff --git a/bin/backend.php b/bin/backend.php
index eed0cfd..49c2c66 100755
--- a/bin/backend.php
+++ b/bin/backend.php
@@ -52,10 +52,9 @@ switch ($action)
break;
case ("getStreamInfo"):
- $session = $_REQUEST['session'];
- $tree = file_get_contents("textfiles/getStreamInfo-" . $session . ".txt");
- print $tree;
- break;
+ $tree = getStreamInfo($_REQUEST['session']);
+ print $tree;
+ break;
case ("startBroadcast"):
$tree = startBroadcast($_REQUEST['type'], $_REQUEST['url'], $_REQUEST['mode']);
@@ -63,32 +62,29 @@ switch ($action)
break;
case ("stopBroadcast"):
- $tree = file_get_contents("textfiles/stopBroadcast.txt");
- print $tree;
- break;
+ $tree = stopBroadcast($_REQUEST['session']);
+ print $tree;
+ break;
case ("getStreamStatus"):
- $time = time();
- $session = $_REQUEST['session'];
- $prevmsg = $_REQUEST['msg'];
- while((time() - $time) < 29)
- {
- $tree = file_get_contents("textfiles/getStreamStatus.txt");
- $data = json_decode($tree);
- $message = $data->message;
- $status = $data->status;
- if ($prevmsg != $message) {
- print $tree;
- break;
- }
- else if ($status == "ready")
+ $time = time();
+ $session = $_REQUEST['session'];
+ $prevmsg = $_REQUEST['msg'];
+ while((time() - $time) < 29)
{
- print $tree;
- break;
+ // Get current status
+ $status = getStreamStatus($session);
+
+ $statusdec = json_decode($status);
+ if (($statusdec->message != prevmsg) || ($statusdec->status == "ready"))
+ {
+ print $status;
+ break;
+ }
+
+ usleep(1000);
}
- usleep(1000);
- }
- break;
+ break;
case ("getTimers"):
$tree = file_get_contents("textfiles/getTimers.txt");