mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-24 14:30:03 +01:00
Add passthru delegate and avconv support.
This commit is contained in:
parent
365b6d8019
commit
08e18b40b5
@ -48,12 +48,14 @@ html.no-js.browser( lang="en" )
|
||||
span.label Use EXIF thumbs
|
||||
span.result ?
|
||||
div.info PHP EXIF extension available
|
||||
li.test( data-id="ffmpeg" )
|
||||
li.test( data-id="moviethumbs" )
|
||||
span.label Movie thumbs
|
||||
span.result ?
|
||||
div.info
|
||||
| Command line program
|
||||
code ffmpeg
|
||||
| or
|
||||
code avconv
|
||||
| available
|
||||
li.test( data-id="convert" )
|
||||
span.label PDF thumbs
|
||||
|
@ -310,6 +310,7 @@ class App {
|
||||
$zip = @preg_match("/zip(.exe)?$/i", exec_cmd($cmd . " zip")) > 0;
|
||||
$convert = @preg_match("/convert(.exe)?$/i", exec_cmd($cmd . " convert")) > 0;
|
||||
$ffmpeg = @preg_match("/ffmpeg(.exe)?$/i", exec_cmd($cmd . " ffmpeg")) > 0;
|
||||
$avconv = @preg_match("/avconv(.exe)?$/i", exec_cmd($cmd . " avconv")) > 0;
|
||||
$du = @preg_match("/du(.exe)?$/i", exec_cmd($cmd . " du")) > 0;
|
||||
|
||||
return array(
|
||||
@ -323,6 +324,8 @@ class App {
|
||||
"zip" => $zip,
|
||||
"convert" => $convert,
|
||||
"ffmpeg" => $ffmpeg,
|
||||
"avconv" => $avconv,
|
||||
"moviethumbs" => $ffmpeg || $avconv,
|
||||
"du" => $du
|
||||
);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class Archive {
|
||||
$cmd = str_replace("[DIRS]", count($this->dirs) ? implode(" ", array_map("escapeshellarg", $this->dirs)) : "", $cmd);
|
||||
$cmd = str_replace("[FILES]", count($this->files) ? implode(" ", array_map("escapeshellarg", $this->files)) : "", $cmd);
|
||||
try {
|
||||
passthru($cmd);
|
||||
passthru_cmd($cmd);
|
||||
} catch (Exeption $err) {
|
||||
return 500;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
class Thumb {
|
||||
|
||||
private static $FFMPEG_CMD = "ffmpeg -ss 0:01:00 -i [SOURCE] -an -vframes 1 [TARGET]";
|
||||
private static $AVCONV_CMD = "avconv -ss 0:01:00 -i [SOURCE] -an -vframes 1 [TARGET]";
|
||||
private static $CONVERT_CMD = "convert -strip [SOURCE][0] [TARGET]";
|
||||
private static $THUMB_CACHE = "thumbs";
|
||||
|
||||
@ -36,6 +37,9 @@ class Thumb {
|
||||
$capture_abs_path = $source_abs_path;
|
||||
} else if ($type === "mov") {
|
||||
$capture_abs_path = $this->capture(Thumb::$FFMPEG_CMD, $source_abs_path);
|
||||
if ($capture_abs_path === null) {
|
||||
$capture_abs_path = $this->capture(Thumb::$AVCONV_CMD, $source_abs_path);
|
||||
}
|
||||
} else if ($type === "doc") {
|
||||
$capture_abs_path = $this->capture(Thumb::$CONVERT_CMD, $source_abs_path);
|
||||
}
|
||||
|
@ -77,8 +77,14 @@ function exec_cmd($cmd) {
|
||||
$lines = array();
|
||||
$rc = null;
|
||||
exec($cmd, $lines, $rc);
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
return implode('\n', $lines);
|
||||
function passthru_cmd($cmd) {
|
||||
|
||||
$rc = null;
|
||||
passthru($cmd, $rc);
|
||||
return $rc;
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user