diff options
author | TheTroll <trolldev@gmail.com> | 2010-02-27 19:01:05 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-02-27 19:01:05 +0100 |
commit | ba0c6b5de1803eb14af25647322d0f0996ac6902 (patch) | |
tree | ebb20bf34bbaf26af5ffcdad2775662e58042c53 /includes | |
parent | fea360ceb0c1222e0691bf825c76fce25b8495ef (diff) | |
download | istreamdev-ba0c6b5de1803eb14af25647322d0f0996ac6902.tar.gz istreamdev-ba0c6b5de1803eb14af25647322d0f0996ac6902.tar.bz2 |
WIP
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/inc_session.php | 3 | ||||
-rwxr-xr-x | includes/include.php | 35 |
2 files changed, 22 insertions, 16 deletions
diff --git a/includes/inc_session.php b/includes/inc_session.php index 6bee609..743fcf3 100755 --- a/includes/inc_session.php +++ b/includes/inc_session.php @@ -43,9 +43,6 @@ function sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, else generatelogo($type, $name, 'ram/' .$session .'/logo.png'); - // Copy status waiter - exec('cp streamstatus.php ram/' .$session); - return $session; } diff --git a/includes/include.php b/includes/include.php index 177a1c0..4db98a8 100755 --- a/includes/include.php +++ b/includes/include.php @@ -14,6 +14,8 @@ include ('getid3/getid3.php'); function selectpage() { + global $maxencodingprocesses; + // Sanity check if (!file_exists('ram')) die("Error: 'ram/' directory is missing, please create it!"); @@ -26,19 +28,26 @@ function selectpage() include('includes/inc_streaming.php'); break; case ("startstream"): - $type = $_REQUEST['type']; - $name = $_REQUEST['name']; - $title = $_REQUEST['title']; - $desc = stripslashes ($_REQUEST['desc']); - $qname = $_REQUEST['qname']; - $qparams = $_REQUEST['qparams']; - $category = $_REQUEST['category']; - $url = $_REQUEST['url']; - $mediapath = $_REQUEST['mediapath']; - $subdir = $_REQUEST['subdir']; - $session = sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir); - include('includes/inc_streaming.php'); - break; + // Dont create a session if too much are running already + $nbencprocess = exec("find ram/ -name segmenter.pid | wc | awk '{ print $1 }'"); + if ($nbencprocess < $maxencodingprocesses) + { + $type = $_REQUEST['type']; + $name = $_REQUEST['name']; + $title = $_REQUEST['title']; + $desc = stripslashes ($_REQUEST['desc']); + $qname = $_REQUEST['qname']; + $qparams = $_REQUEST['qparams']; + $category = $_REQUEST['category']; + $url = $_REQUEST['url']; + $mediapath = $_REQUEST['mediapath']; + $subdir = $_REQUEST['subdir']; + $session = sessioncreate($type, $name, $title, $desc, $qname, $qparams, $category, $url, $mediapath, $subdir); + include('includes/inc_streaming.php'); + } + else + include('includes/inc_stream.php'); + break; case ("stopstream"): sessiondelete($_REQUEST['session']); // NO BREAK; |