This commit is contained in:
2019-10-15 20:09:49 -07:00
parent 3ca3ef2685
commit f297d9d846
7 changed files with 36 additions and 33 deletions

View File

@@ -10,12 +10,15 @@ $p = unserialize(file_get_contents($prefs_file));
require("functions.php");
require("filetypes.php");
$redirect = "2>&1";
//$redirect = "2> /tmp/yuba/debug.log";
$dm = "";
function dfm ($string, $flag = 0) {
// dumb workaround for debug messages appearing out of order
// bypass for single-thread to observe hangs
//dm($string);
//return
// uncomment next line to revert to instant message printing
dm($string); return;
global $dm;
if ($flag == 1) {
$dm .= str_repeat("-",33)."\n".$string."\n".str_repeat("-",33)."\n";
@@ -52,7 +55,7 @@ $dbp->query("PRAGMA journal_mode = WAL");
$sbatch = array();
$estring = "\nBATCH: ".shortlabel(basename($pathname),20);
$estring = "\n[BATCH] ".shortlabel(basename($pathname),20);
dfm("BATCH INIT ".$file.":".print_r($argv,true),2);
@@ -131,14 +134,11 @@ if ($p['thumbs']) {
$cmd['ql-thumbnail'] = $bin_qlthumb." ".$shellpath." ".$tfile." public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8";
$cmd['qlmanage'] = $bin_qlmanage." -t -s ".$p['thumb_size']." -o ".dirname($tpfile)." ".$shellpath."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($tpfile)." --out ".$tfile;
if (in_array($ext, $p['t_files']['sips'])) {
$external_tool = "sips";
} elseif (in_array($ext, $p['t_files']['ffmpeg'])) {
$external_tool = "ffmpeg";
} elseif (in_array($ext, $p['t_files']['sox'])) {
$external_tool = "sox";
} else {
$external_tool = null;
$external_tool = null;
foreach ($p['t_files'] as $tool => $whitelist) {
if (in_array($ext, $whitelist)) {
$external_tool = $tool;
}
}
dfm("external tool for ".$ext." = ".$external_tool);
switch ($p['thumb_mode']) {
@@ -157,7 +157,7 @@ if ($p['thumbs']) {
if (empty($cmd[$tool])) { continue; }
dfm($cmd[$tool]);
shell_exec($cmd[$tool]." 2>&1");
shell_exec($cmd[$tool]." 2>1");
$estring .= " ->".$tool;
$checksize = @filesize($tfile);
@@ -244,7 +244,7 @@ if ($p['icons']) {
dfm("icon mode 2, bypassing hash check");
$tool = "ql-icon";
shell_exec($cmd[$tool]." 2>&1");
shell_exec($cmd[$tool]." ".$redirect);
$stmt->BindValue(":tool",$tool);
dfm($cmd[$tool]);
$estring .= " ->".$tool;
@@ -274,7 +274,7 @@ if ($p['icons']) {
}
foreach ($tools as $tool) {
if (!@filesize($tfile)) {
shell_exec($cmd[$tool]." 2>&1");
shell_exec($cmd[$tool]." ".$redirect);
dfm($cmd[$tool]);
$estring .= " ->".$tool;
}
@@ -375,7 +375,7 @@ if ($p['meta']) {
dfm("creating mediainfo dump");
$stmt = $dbp->prepare("INSERT INTO mediainfo VALUES (:fid, :info)");
$stmt->BindValue(":fid",$fid);
$stmt->BindValue(":info",shell_exec($bin_mediainfo." --Output=JSON ".$shellpath." 2>&1"));
$stmt->BindValue(":info",shell_exec($bin_mediainfo." --Output=JSON ".$shellpath." ".$redirect));
$sbatch[] = $stmt;
$estring .= " ->minfo";
} else {