This commit is contained in:
2019-10-15 18:32:21 -07:00
parent 1bf543ec00
commit a344259e40
77 changed files with 308 additions and 220 deletions

View File

@@ -38,6 +38,7 @@ require("filetypes.php");
$wopt_steps = 8; // total number of steps
$wopt_currstep = 1;
if ($p['debug']) { $wopt_clear = 0; } else { $wopt_clear = 1; }
$wopt_debug_unique = 0;
$parser = new plistParser();
@@ -98,10 +99,11 @@ if ($p['contents'] && !extension_loaded("zip")) {
if (!isset($argv[1]) || $argv[1] == "") { echo "No input"; die; }
$zpath = realpath(@$argv[1]);
if ($p['bdest']) { $bdest = realpath($p['bdest']); } else { $bdest = "/Users/".get_current_user()."/Documents/Yuba/"; }
if (!is_dir($bdest)) { if (!mkdir($bdest)) { echo "Error creating directory: ".$bdest; die; } }
if (!is_dir($bdest)) { if (!mkdir($bdest,0777,true)) { echo "Error creating destination directory"; die; } }
// Check for bundle
if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); }
if ($wopt_debug_unique) { $blabel .= "-".$mytime; }
if (is_writable($zpath)) { echo "Warning: source is writeable\n"; }
$bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle";
@@ -660,12 +662,12 @@ foreach (array_merge($mb['t'],$mb['a']) as $item) {
$ibuild[] = ":".$item;
}
$dbo->exec("CREATE TABLE mdls (".implode(",",$cbuild).")");
if ($p['spotlight']) {
echo ProgressBar::start($passed_total,"Spotlight (".stepString().")");
$dbo->exec("CREATE TABLE mdls (".implode(",",$cbuild).")");
foreach ($files as $splFileInfo) {
$path = $splFileInfo->getPathname();
@@ -887,7 +889,7 @@ foreach ($files as $splFileInfo) {
} elseif ($type == "dir") {
if (@is_array($dpreview) && $dpreview[$pathname]) {
if (is_array($dpreview) && @$dpreview[$pathname]) {
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$dpreview[$pathname]."'")->fetch();
if (@$fetch_thumb['relative_path']) {
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
@@ -1036,9 +1038,11 @@ while ($row_a = $loop->fetch()) {
}
$m['m']['SkimTrackCount'] = @count($m_base);
foreach (@$m_base as $track) {
if (!@$m['m']['SkimDims'] && @$track['Width'] && @$track['Height']) {
$m['m']['SkimDims'] = @sanitize($track['Width'],"i").$display_delimiter.@sanitize($track['Height'],"i");
if (is_array($m_base)) {
foreach (@$m_base as $track) {
if (!@$m['m']['SkimDims'] && @$track['Width'] && @$track['Height']) {
$m['m']['SkimDims'] = @sanitize($track['Width'],"i").$display_delimiter.@sanitize($track['Height'],"i");
}
}
}
@@ -1108,7 +1112,10 @@ $dbo->exec("UPDATE _skim SET status='completed_in_".$seconds."'");
// rsync
if ($p['postflight'] == 2 && $p['rsync_dest']) {
if ($p['postflight'] == 3) {
$url = "http://localhost/rtc.php?db=data/".basename($bpath)."/".$stamp.".sqlite3";
exec("open ".$url);
} elseif ($p['postflight'] == 2 && $p['rsync_dest']) {
echo msg("rsync...");
$command = "rsync -avv -e ssh ".$bpath." ".$p['rsync_dest'];
$count = trim(shell_exec("find ".escapeshellarg($bpath)." | wc -l"));