本文整理汇总了PHP中X_Env::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP X_Env::execute方法的具体用法?PHP X_Env::execute怎么用?PHP X_Env::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X_Env
的用法示例。
在下文中一共展示了X_Env::execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forceKill
public function forceKill()
{
if (!X_Env::isWindows()) {
X_Env::execute("kill -9 `ps aux | grep {$this->path} | grep -v grep | awk '{print \$2}'`", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
} else {
X_Env::execute("taskkill /IM SopCast.exe /F", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
}
}
示例2: startEngine
public function startEngine(X_Threads_Thread $thread)
{
// assume all parameters are ready
$thread->log("Spawning SopCast...");
$source = $this->getParam('source');
$command = (string) X_SopCast::getInstance()->setUri($source);
X_Env::execute($command, X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
//$this->vlc->spawn();
$thread->log("SopCast execution finished");
}
示例3: startEngine
public function startEngine(X_Threads_Thread $thread)
{
// assume all parameters are ready
$thread->log("Spawning RTMPDump (rtmpgw-own3d)...");
$source = $this->getParam('source');
// set the path
if (X_Env::isWindows()) {
X_RtmpDumpOwn3d::getInstance()->setPath(APPLICATION_PATH . '/../bin/rtmpdump-own3d-win/rtmpgw-own3d.exe');
} else {
X_RtmpDumpOwn3d::getInstance()->setPath(APPLICATION_PATH . '/../bin/rtmpdump-own3d-linux/rtmpgw-own3d');
}
$own3dPlugin = X_VlcShares_Plugins::broker()->getPlugins('own3d');
if ($own3dPlugin instanceof X_VlcShares_Plugins_Own3d) {
// try to get reference to vlc-streamer
/* @var $vlcStreamer X_Streamer_Engine_Vlc */
//$vlcStreamer = X_VlcShares_Plugins::helpers()->streamer()->get('vlc');
// get the channel id
//$source = substr($source, strlen('rtmpdump-own3d://'));
// make the plugin to parse params from server and build a rtmpdump-weebtv uri
//$source = $weebPlugin->getLinkParams($source);
// always live
//$command = (string) X_RtmpDumpOwn3d::getInstance()/*->setLive(true)*/->parseUri($source)/*->setStreamPort($weebPlugin->getStreamingPort())*/;
/*
$vlcStreamer->getVlcWrapper()->setPipe($command);
$vlcStreamer->setSource('-');
$vlcStreamer->setParam('profile', "#std{access=http{mime=video/x-flv},mux=ffmpeg{mux=flv},dst=0.0.0.0:{$own3dPlugin->getStreamingPort()}/stream}");
// redirect std error to null
// and force quite
//X_Env::execute("$command -q 2> /dev/null", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
//X_Env::execute($command, X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
$vlcStreamer->getVlcWrapper()->spawn();
*/
$command = (string) X_RtmpDumpOwn3d::getInstance()->parseUri($source)->setStreamPort($own3dPlugin->getStreamingPort());
X_Env::execute($command, X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
$thread->log("RTMPDump execution finished");
} else {
$thread->log("RTMPDump-own3d cannot be started without own3d plugin and vlc streamer");
}
}
示例4: _invoke
private function _invoke()
{
$source = $this->_location;
$osTweak = X_Env::isWindows() ? '2>&1' : '2>&1';
$ffmpeg = "\"{$this->options->path}\"";
$str = X_Env::execute("{$ffmpeg} -i \"{$source}\" {$osTweak}", X_Env::EXECUTE_OUT_ARRAY, X_Env::EXECUTE_PS_WAIT);
return $str;
}
示例5: _send
private function _send($command, $outtype = X_Env::EXECUTE_OUT_NONE)
{
X_Env::debug(__METHOD__ . ": sending message {$command}");
$command = str_replace('{%command%}', $command, $this->nc_command);
$return = X_Env::execute($command, $outtype, X_Env::EXECUTE_PS_WAIT);
if ($outtype != X_Env::EXECUTE_OUT_NONE) {
X_Env::debug("Reply:");
X_Env::debug(print_r($return, true));
}
return $return;
}
示例6: _invoke
private function _invoke()
{
$source = $this->_location;
$mediainfo = "\"{$this->options->path}\"";
$str = X_Env::execute("{$mediainfo} --Output=XML \"{$source}\"", X_Env::EXECUTE_OUT_IMPLODED, X_Env::EXECUTE_PS_WAIT);
return trim($str);
}
示例7: thumbAction
function thumbAction()
{
// time to get params from get
/* @var $request Zend_Controller_Request_Http */
$request = $this->getRequest();
if (!is_writable(APPLICATION_PATH . "/../public/images/fsthumbs/thumbs/")) {
throw new Exception('"/public/images/fsthumbs/thumbs/" must be writable');
}
$l = $request->getParam('l', false);
if ($l == false) {
throw new Exception(X_Env::_('p_fsthumbs_invalidlocation'));
}
$ldec = X_Env::decode($l);
$itemRealPath = $this->fsPlugin->resolveLocation($ldec);
if ($itemRealPath == false) {
throw new Exception(X_Env::_('p_fsthumbs_invalidlocation'));
}
// cache check and redirect if possible
$imagePath = "/images/fsthumbs/thumbs/{$l}.jpg";
// else thumb creation and then redirect
if (!file_exists(APPLICATION_PATH . "/../public{$imagePath}")) {
if (X_VlcShares_Plugins::helpers()->ffmpeg()->isEnabled()) {
// create the thumb
$ffmpegPath = $this->options->helpers->ffmpeg->path;
$destPath = APPLICATION_PATH . "/../public{$imagePath}";
$secOffset = intval($this->plugin->config('capture.seconds', '2')) + (int) rand(0, 10) - 5;
if ($secOffset < 1) {
$secOffset = 1;
}
$imageDim = $this->plugin->config('thumbs.size', '320x240');
if (!preg_match('/(\\d{3})x(\\d{3})/', $imageDim)) {
X_Debug::e("Thumb size is not a valid value (IIIxIII): {$imageDim}");
$imageDim = '320x240';
}
// thumb creation should be always completed
ignore_user_abort(true);
// semaphore is needed for folders with lots files and low-end cpus
$lockFile = fopen(__FILE__, 'r+');
flock($lockFile, LOCK_EX);
$exec = "{$ffmpegPath} -itsoffset -{$secOffset} -i \"{$itemRealPath}\" -vcodec mjpeg -vframes 1 -an -f rawvideo -s {$imageDim} \"{$destPath}\"";
$return = X_Env::execute($exec);
// remove lock
flock($lockFile, LOCK_UN);
fclose($lockFile);
$filesize = @filesize($destPath);
if ($filesize == 0) {
// it's better to replace the thumbs created with
// a placeholder file to prevent a new creation
@copy(APPLICATION_PATH . "/../public/images/fsthumbs/nothumbs.jpg", $destPath);
clearstatcache(true, $destPath);
$filesize = @filesize($destPath);
}
$thumb = new Application_Model_FsThumb();
// try to load an old entry in db, this prevent error when files are removed but not the reference in db
Application_Model_FsThumbsMapper::i()->fetchByPath($itemRealPath, $thumb);
$thumb->setCreated(time())->setPath($itemRealPath)->setUrl($imagePath)->setSize(@filesize($destPath));
try {
Application_Model_FsThumbsMapper::i()->save($thumb);
X_Debug::i('Thumb stored');
} catch (Exception $e) {
X_Debug::e("Error while storing thumb data: {$e->getMessage()}");
}
//X_Debug::i(var_export($return, true));
// -itsoffset -30 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
} else {
$imagePath = "/images/fsthumbs/nothumbs.jpg";
}
}
// if it is wiimc i have to return here the image directly, not a redirect
if (X_VlcShares_Plugins::helpers()->devices()->isWiimc()) {
$this->getResponse()->clearAllHeaders();
ob_end_clean();
$this->getResponse()->setHeader('Content-Type', 'image/jpeg')->setHeader('Content-Length', @filesize(APPLICATION_PATH . "/../public{$imagePath}"));
$this->getResponse()->sendHeaders();
readfile(APPLICATION_PATH . "/../public{$imagePath}");
} else {
$this->_helper->redirector->gotoUrlAndExit($imagePath, array('prependBase' => true, 'code' => 302));
}
}
示例8: forceKill
public function forceKill()
{
if (!X_Env::isWindows()) {
X_Env::execute("killall rtmpgw-own3d", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
} else {
X_Env::execute("taskkill /IM rtmpgw-own3d.exe /F", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
}
}
示例9: forceKillAll
/**
*
*/
public function forceKillAll()
{
X_Env::execute("taskkill /IM vlc.exe /F", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
if (file_exists($this->pidFile)) {
@unlink($this->pidFile);
}
}
示例10: forceKillAll
/**
*
*/
public function forceKillAll()
{
$path = '"' . trim($this->_options->get('path', 'vlc'), '"') . '"';
X_Env::execute("killall {$path}", X_Env::EXECUTE_OUT_NONE, X_Env::EXECUTE_PS_WAIT);
}