diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-17 14:06:08 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-17 14:06:08 +0100 |
commit | 737a6402836788d359fcd99bef93ae059c085577 (patch) | |
tree | 2cb70992cf1fe452ebec552970b49e5a31cfb712 /bin/backend.php | |
parent | 4e2acf476cadde8495ff3cf484a866fe8d0ba8ec (diff) | |
download | istreamdev-737a6402836788d359fcd99bef93ae059c085577.tar.gz istreamdev-737a6402836788d359fcd99bef93ae059c085577.tar.bz2 |
Session start/stop implemented
Diffstat (limited to 'bin/backend.php')
-rwxr-xr-x | bin/backend.php | 48 |
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"); |