本文整理汇总了PHP中nzedb\utility\Misc::runCmd方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::runCmd方法的具体用法?PHP Misc::runCmd怎么用?PHP Misc::runCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nzedb\utility\Misc
的用法示例。
在下文中一共展示了Misc::runCmd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getMediaInfo
/**
* Try to get media info xml from a video file.
*
* @param string $fileLocation
*
* @return bool
*/
protected function _getMediaInfo($fileLocation)
{
if (!$this->_processMediaInfo) {
return false;
}
// Look for the video file.
if (is_file($fileLocation)) {
// Run media info on it.
$xmlArray = Misc::runCmd($this->_killString . $this->pdo->getSetting('mediainfopath') . '" --Output=XML "' . $fileLocation . '"');
// Check if we got it.
if (is_array($xmlArray)) {
// Convert it to string.
$xmlArray = implode("\n", $xmlArray);
if (!preg_match('/<track type="(Audio|Video)">/i', $xmlArray)) {
return false;
}
// Insert it into the DB.
$this->_releaseExtra->addFull($this->_release['id'], $xmlArray);
$this->_releaseExtra->addFromXml($this->_release['id'], $xmlArray);
if ($this->_echoCLI) {
$this->_echo('m', 'primaryOver', false);
}
return true;
}
}
return false;
}
示例2: _decodeIgnoreYEnc
/**
* Decode a string of text encoded with yEnc. Ignores all errors.
*
* @param string $data The encoded text to decode.
*
* @return string The decoded yEnc string, or the input string, if it's not yEnc.
*
* @access protected
*/
protected function _decodeIgnoreYEnc(&$data)
{
if (preg_match('/^(=yBegin.*=yEnd[^$]*)$/ims', $data, $input)) {
// If there user has no yyDecode path set, use PHP to decode yEnc.
if ($this->_yyDecoderPath === false) {
$data = '';
$input = trim(preg_replace('/\\r\\n/im', '', preg_replace('/(^=yEnd.*)/im', '', preg_replace('/(^=yPart.*\\r\\n)/im', '', preg_replace('/(^=yBegin.*\\r\\n)/im', '', $input[1], 1), 1), 1)));
$length = strlen($input);
for ($chr = 0; $chr < $length; $chr++) {
$data .= $input[$chr] !== '=' ? chr(ord($input[$chr]) - 42) : chr(ord($input[++$chr]) - 64 - 42);
}
} else {
if ($this->_yEncExtension) {
$data = \simple_yenc_decode($input[1]);
} else {
$inFile = $this->_yEncTempInput . mt_rand(0, 999999);
$ouFile = $this->_yEncTempOutput . mt_rand(0, 999999);
file_put_contents($inFile, $input[1]);
file_put_contents($ouFile, '');
Misc::runCmd("'" . $this->_yyDecoderPath . "' '" . $inFile . "' -o '" . $ouFile . "' -f -b" . $this->_yEncSilence);
$data = file_get_contents($ouFile);
if ($data === false) {
$data = $this->throwError('Error getting data from yydecode.');
}
unlink($inFile);
unlink($ouFile);
}
}
}
return $data;
}