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