Debug output tweak

This commit is contained in:
2019-06-12 23:26:54 -07:00
parent 53c520097c
commit 308d3c513a
3 changed files with 37 additions and 32 deletions

View File

@@ -26,6 +26,7 @@ require("filetypes.php");
$wopt_steps = 12; $wopt_steps = 12;
$wopt_currstep = 1; $wopt_currstep = 1;
$wopt_clear = 0;
$parser = new plistParser(); $parser = new plistParser();
@@ -462,7 +463,7 @@ foreach ($files as $splFileInfo) {
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
// Thow permissions error // Thow permissions error
@@ -476,13 +477,28 @@ if (count($noread)) {
// Write family to DB // Write family to DB
$dupes = array_filter($dx, function($a) { return count($a) > 1; });
$dupecount = 0;
$dupetotal = 0;
if (count($dupes)) {
$dupecount = count($dupes,COUNT_RECURSIVE) - count($dupes);
$dupetotal = floor(($dupecount/$passed_total)*100);
foreach ($dupes as $fid => $array) {
$stmt = $dbo->prepare("INSERT INTO dupes VALUES (:fid, :array)");
$stmt->BindValue(":fid",$fid);
$stmt->BindValue(":array",serialize($array));
$stmt->execute();
}
}
$message = "Writing family to DB: "; $message = "Writing family to DB: ";
$message .= $passed_file." files, "; $message .= $passed_file." files, ";
$message .= $passed_dir." dirs, "; $message .= $passed_dir." dirs, ";
$message .= $nodescended." bundles, "; $message .= $nodescended." bundles, ";
$message .= $passed_link." links, "; $message .= $passed_link." links, ";
$message .= $ignored." ignored, "; $message .= $ignored." ignored, ";
//$message .= (@$dupecount ? $dupecount : 0)." dupes"; $message .= $dupecount." dupes (".$dupetotal."%)";
echo ProgressBar::start(count($family),$message); echo ProgressBar::start(count($family),$message);
@@ -502,23 +518,7 @@ foreach ($family as $key => $item) {
} }
// Dupes echo ProgressBar::finish($wopt_clear);
$dupes = array_filter($dx, function($a) { return count($a) > 1; });
if (count($dupes)) {
$dupecount = count($dupes,COUNT_RECURSIVE) - count($dupes);
$dupetotal = floor(($dupecount/$passed_total)*100);
echo ProgressBar::next("Recording dupes (".$dupetotal."%)");
foreach ($dupes as $fid => $array) {
$stmt = $dbo->prepare("INSERT INTO dupes VALUES (:fid, :array)");
$stmt->BindValue(":fid",$fid);
$stmt->BindValue(":array",serialize($array));
$stmt->execute();
}
}
echo ProgressBar::finish();
// create an index for family db // create an index for family db
$dbo->exec("CREATE INDEX family_index ON family (pid)"); $dbo->exec("CREATE INDEX family_index ON family (pid)");
@@ -551,7 +551,7 @@ foreach ($fx as $array) {
} }
echo ProgressBar::next(); echo ProgressBar::next();
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
// Icons Test // Icons Test
////////////////////////////////////////// //////////////////////////////////////////
@@ -576,13 +576,13 @@ if ($p['icons']) {
} }
file_put_contents($batchfile,implode("\n", $line)); file_put_contents($batchfile,implode("\n", $line));
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
echo ProgressBar::start($passed_file,"Running icon batch (".stepString().")"); echo ProgressBar::start($passed_file,"Running icon batch (".stepString().")");
passthru($bin_parallel." < ".$batchfile); passthru($bin_parallel." < ".$batchfile);
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
} }
@@ -712,7 +712,7 @@ if ($p['thumbs']) {
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
} }
@@ -760,7 +760,7 @@ if ($p['contents']) {
echo ProgressBar::next(true); echo ProgressBar::next(true);
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
} }
@@ -822,7 +822,7 @@ if ($p['meta']) {
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
} }
@@ -858,7 +858,7 @@ if ($p['hash']) {
} }
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
} }
@@ -968,7 +968,7 @@ if ($p['spotlight']) {
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
} }
@@ -1197,7 +1197,7 @@ foreach ($files as $splFileInfo) {
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
// Milk // Milk
////////////////////////////////////////// //////////////////////////////////////////
@@ -1349,7 +1349,7 @@ while ($row_a = $loop->fetch()) {
} }
echo ProgressBar::finish(); echo ProgressBar::finish($wopt_clear);
// Cleanup // Cleanup
////////////////////////////////////////// //////////////////////////////////////////

View File

@@ -59,11 +59,16 @@ class ProgressBar {
return self::display($message); return self::display($message);
} }
public static function finish() { public static function finish($clear = null) {
global $wopt_currstep; global $wopt_currstep;
$wopt_currstep++; $wopt_currstep++;
self::$done = 0; self::$done = 0;
if ($clear) {
return "\nREFRESH\n"; return "\nREFRESH\n";
} else {
return "\n".str_repeat("*",99)."\n";
}
} }
} }

View File

@@ -45,7 +45,7 @@ switch ($mode) {
$stmt->BindValue(":tool",$row['tool']); $stmt->BindValue(":tool",$row['tool']);
} else { } else {
$dfile = $bpath."/icons/".substr($hash, 0, 2)."/".$hash.".png"; $dfile = $bpath."/icons/".substr($hash, 0, 2)."/".$hash.".png";
if (!is_dir(dirname($dfile))) { mkdir(dirname($dfile)); } if (!is_dir(dirname($dfile))) { @mkdir(dirname($dfile)); }
shell_exec("sips -z ".$p['thumb_size']." ".$p['thumb_size']." ".$tfile." --out ".$dfile); shell_exec("sips -z ".$p['thumb_size']." ".$p['thumb_size']." ".$tfile." --out ".$dfile);
$stmt->BindValue(":created",time()); $stmt->BindValue(":created",time());
$stmt->BindValue(":relative_path",substr($dfile,strlen($bpath))); $stmt->BindValue(":relative_path",substr($dfile,strlen($bpath)));