0.8.0.1
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file. Older changes are summarized on individual commits.
|
||||
|
||||
## [0.8.0.1]
|
||||
- Move batchfile generation to Prescan
|
||||
- Rewrite batchfile generation (batch now handles files, links, dirs)
|
||||
- Rewrite spotlight and move to batch
|
||||
- Replace directory previews with flacdiricon tool
|
||||
|
||||
## [0.8.0.0]
|
||||
- Refactor for thumb/icon "modes"
|
||||
- Integrate ql-icon
|
||||
|
||||
2
MainMenu.nib/designable.nib
generated
2
MainMenu.nib/designable.nib
generated
@@ -55,7 +55,7 @@
|
||||
<rect key="contentRect" x="472" y="537" width="600" height="83"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
|
||||
<value key="minSize" type="size" width="600" height="83"/>
|
||||
<value key="maxSize" type="size" width="1200" height="83"/>
|
||||
<value key="maxSize" type="size" width="1800" height="83"/>
|
||||
<view key="contentView" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="83"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
|
||||
BIN
MainMenu.nib/keyedobjects.nib
generated
BIN
MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
|
||||
**Yuba** generates web-browsable catalogues from locally attached HFS+ filesystems. Its client application gathers forensic-quality data about a volume, properly interpreting bundles, reading Spotlight data, Finder flags, labels, and other contextual information. It can generate hashes, thumbnails, and gather 3rd party metadata with exiftool and mediainfo. Yuba's SQLite catalogues are comprehensive, lightweight, optimized for massive (1 million+) trees, and reflect incremental changes to contents and metadata. A server-side PHP script is provided, which allows familiar, Finder-style browsing of a catalogue.
|
||||
|
||||
####[⇩ Download Yuba 0.8.0.0](https://www.profiteroles.org/git/p/Yuba/raw/master/Yuba.app.zip) ([Changelog](CHANGELOG.md))
|
||||
####[⇩ Download Yuba 0.8.0.1](https://www.profiteroles.org/git/p/Yuba/raw/master/Yuba.app.zip) ([Changelog](CHANGELOG.md))
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
BIN
Tester.zip
BIN
Tester.zip
Binary file not shown.
BIN
Yuba.app.zip
BIN
Yuba.app.zip
Binary file not shown.
200
Yuba.php
200
Yuba.php
@@ -35,7 +35,7 @@ require("filetypes.php");
|
||||
|
||||
// Manual prefs
|
||||
|
||||
$wopt_steps = 8; // total number of steps
|
||||
$wopt_steps = 7; // total number of steps
|
||||
$wopt_currstep = 1;
|
||||
if ($p['debug']) { $wopt_clear = 0; } else { $wopt_clear = 1; }
|
||||
$wopt_debug_unique = 0;
|
||||
@@ -307,6 +307,7 @@ $dbo->exec("CREATE TABLE files (
|
||||
thumb_height INTEGER,
|
||||
thumb_tool TEXT,
|
||||
icon_filename TEXT,
|
||||
icon_tool TEXT,
|
||||
contents_filename TEXT
|
||||
)");
|
||||
|
||||
@@ -421,6 +422,7 @@ $fids = array();
|
||||
$noread = array();
|
||||
$fx = new SplFixedArray($passed_file);
|
||||
$splcount = 0;
|
||||
$bline = array();
|
||||
|
||||
echo ProgressBar::start($passed_total,"Prescan (".stepString().")");
|
||||
|
||||
@@ -431,6 +433,8 @@ foreach ($files as $splFileInfo) {
|
||||
$shellpath = escapeshellarg($splFileInfo->getPathname());
|
||||
$realpath = $splFileInfo->getRealPath();
|
||||
|
||||
$fid = md5($splFileInfo->getSize().$splFileInfo->getMtime().$splFileInfo->getBasename());
|
||||
|
||||
$key = md5($pathname);
|
||||
$pkey = md5($path);
|
||||
|
||||
@@ -444,7 +448,6 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
if ($splFileInfo->getType() != "dir" && $splFileInfo->getType() != "link") {
|
||||
|
||||
$fid = md5($splFileInfo->getSize().$splFileInfo->getMtime().$splFileInfo->getBasename());
|
||||
$dx[$fid][] = $pathname;
|
||||
$fx[$splcount] = array($fid, $pathname);
|
||||
$family[$key]['fid'] = $fid;
|
||||
@@ -473,22 +476,22 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
// Create batch
|
||||
|
||||
$line = array();
|
||||
if ($p['thumbs'] || $p['icons'] || $p['meta'] || $p['hash'] || $p['contents'] || $p['spotlight']) {
|
||||
|
||||
$parts = array();
|
||||
$parts[] = $bin_php;
|
||||
$parts[] = escapeshellarg(realpath("helper2.php"));
|
||||
$parts[] = escapeshellarg(realpath("helper.php"));
|
||||
$parts[] = $i;
|
||||
$parts[] = $passed_total;
|
||||
$parts[] = $fid;
|
||||
$parts[] = escapeshellarg($pathname);
|
||||
$parts[] = $splFileInfo->getType();
|
||||
$parts[] = escapeshellarg($bpath);
|
||||
$parts[] = $mytime;
|
||||
|
||||
$tcmd = implode(" ",$parts);
|
||||
msg($tcmd);
|
||||
$line[] = $tcmd;
|
||||
//msg($tcmd);
|
||||
$bline[] = $tcmd;
|
||||
|
||||
}
|
||||
|
||||
@@ -508,10 +511,9 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$batchfile = $tmpdir."/__batch.sh";
|
||||
if (!empty($line)) {
|
||||
file_put_contents($batchfile,implode("\n", $line));
|
||||
$batchfile = $tmpdir."/batch.sh";
|
||||
if (!empty($bline)) {
|
||||
file_put_contents($batchfile,implode("\n", $bline));
|
||||
msg("Writing batch to file");
|
||||
}
|
||||
|
||||
@@ -591,41 +593,16 @@ $dbo->exec($stmt);
|
||||
|
||||
$wopt_currstep++;
|
||||
|
||||
// Directory Previews
|
||||
// Init Spotlight DB
|
||||
//////////////////////////////////////////
|
||||
|
||||
echo ProgressBar::start(count($fx),"Searching for directory previews (".stepString().")");
|
||||
foreach ($fx as $array) {
|
||||
$fid = $array[0];
|
||||
$pathname = $array[1];
|
||||
if (in_array(basename($pathname),$p['p_files'])) {
|
||||
$dpreview[dirname($pathname)] = $fid;
|
||||
}
|
||||
echo ProgressBar::next();
|
||||
}
|
||||
echo ProgressBar::finish($wopt_clear);
|
||||
if ($p['spotlight']) { $dbo->exec("CREATE TABLE mdls (id INTEGER PRIMARY KEY,".implode(",",$cbuild).")"); }
|
||||
|
||||
// Helper
|
||||
//////////////////////////////////////////
|
||||
|
||||
if ($p['thumbs'] || $p['icons'] || $p['meta'] || $p['hash'] || $p['contents']) {
|
||||
if (file_exists($batchfile)) {
|
||||
|
||||
echo ProgressBar::start($passed_file,"Creating batch (".stepString().")",1);
|
||||
|
||||
$batchfile = $tmpdir."/_batch.sh";
|
||||
$helper = realpath("helper.php");
|
||||
|
||||
foreach ($fx as $count => $array) {
|
||||
$fid = $array[0];
|
||||
$pathname = $array[1];
|
||||
$tcmd = $bin_php." ".escapeshellarg($helper)." ".$fid." ".escapeshellarg($pathname)." ".escapeshellarg($bpath)." ".$mytime."; printf '\\n".ProgressBar::next()."'";
|
||||
msg($tcmd);
|
||||
$line[] = $tcmd;
|
||||
}
|
||||
|
||||
file_put_contents($batchfile,implode("\n", $line));
|
||||
echo ProgressBar::finish($wopt_clear);
|
||||
|
||||
echo ProgressBar::start($passed_file,"Running batch (".stepString().")");
|
||||
if ($p['parallel']) {
|
||||
passthru($bin_parallel." < ".$batchfile);
|
||||
@@ -648,101 +625,7 @@ $dbp->exec("CREATE INDEX IF NOT EXISTS mediainfo_index ON mediainfo (fid)");
|
||||
$dbp->exec("CREATE INDEX IF NOT EXISTS thumbs_index ON thumbs (fid)");
|
||||
$dbp->exec("CREATE INDEX IF NOT EXISTS icons_index ON icons (fid)");
|
||||
|
||||
// Spotlight
|
||||
//////////////////////////////////////////
|
||||
|
||||
$mb['i'] = array( "PixelWidth",
|
||||
"PixelHeight",
|
||||
"Latitude",
|
||||
"Longitude",
|
||||
"DurationSeconds",
|
||||
"UseCount",
|
||||
"FSInvisible",
|
||||
"NumberOfPages",
|
||||
"PageHeight",
|
||||
"PageWidth",
|
||||
"TotalBitRate" );
|
||||
|
||||
$mb['t'] = array( "Title",
|
||||
"ContentType",
|
||||
"Creator",
|
||||
"FSCreatorCode",
|
||||
"Kind",
|
||||
"FSTypeCode" );
|
||||
|
||||
$mb['a'] = array( "UserTags",
|
||||
"WhereFroms",
|
||||
"EncodingApplications" );
|
||||
|
||||
$mb['d'] = array( "DateAdded",
|
||||
"LastUsedDate",
|
||||
"ContentModificationDate",
|
||||
"ContentCreationDate" );
|
||||
|
||||
$ibuild[] = ":pid, :spotlight";
|
||||
$cbuild[] = "pid TEXT, spotlight TEXT";
|
||||
foreach (array_merge($mb['i'],$mb['d']) as $item) {
|
||||
$cbuild[] = $item." INTEGER";
|
||||
$ibuild[] = ":".$item;
|
||||
}
|
||||
foreach (array_merge($mb['t'],$mb['a']) as $item) {
|
||||
$cbuild[] = $item." TEXT";
|
||||
$ibuild[] = ":".$item;
|
||||
}
|
||||
|
||||
$dbo->exec("CREATE TABLE mdls (".implode(",",$cbuild).")");
|
||||
|
||||
if ($p['spotlight']) {
|
||||
|
||||
echo ProgressBar::start($passed_total,"Spotlight (".stepString().")");
|
||||
|
||||
foreach ($files as $splFileInfo) {
|
||||
|
||||
$path = $splFileInfo->getPathname();
|
||||
msg($path);
|
||||
|
||||
$pid = md5($path);
|
||||
$shellpath = escapeshellarg($path);
|
||||
$mdls = shell_exec("mdls -plist - ".$shellpath." 2>&1");
|
||||
|
||||
if (substr_count(@$mdls,"\n") > 1) {
|
||||
$spotlight = $parser->parseString(utf8_for_xml($mdls));
|
||||
} else {
|
||||
$spotlight = array();
|
||||
}
|
||||
|
||||
$stmt = $dbo->prepare("INSERT INTO mdls VALUES (".implode(",",$ibuild).")");
|
||||
|
||||
foreach ($mb as $key => $list) {
|
||||
foreach ($list as $item) {
|
||||
|
||||
if (@$spotlight["kMDItem".$item]) {
|
||||
$stmt->BindValue(":pid",$pid);
|
||||
$stmt->BindValue(":spotlight",$mdls);
|
||||
switch($key) {
|
||||
case "i":
|
||||
case "t":
|
||||
$stmt->BindValue(":".$item,$spotlight["kMDItem".$item]);
|
||||
break;
|
||||
case "a":
|
||||
$stmt->BindValue(":".$item,serialize($spotlight["kMDItem".$item]));
|
||||
break;
|
||||
case "d":
|
||||
$stmt->BindValue(":".$item,strtotime($spotlight["kMDItem".$item]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
echo ProgressBar::next(true);
|
||||
|
||||
}
|
||||
|
||||
echo ProgressBar::finish($wopt_clear);
|
||||
|
||||
}
|
||||
$dbo->exec("CREATE INDEX IF NOT EXISTS mdls_index ON mdls (id)");
|
||||
|
||||
// Files
|
||||
//////////////////////////////////////////
|
||||
@@ -755,7 +638,7 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
// DB
|
||||
|
||||
$stmt = $dbo->prepare("INSERT INTO files VALUES (:pid, :fid, :Pathname, :Path, :Filename, :Extension, :Type, :Size, :Inode, :Perms, :Owner, :ATime, :MTime, :CTime, :LinkTarget, :RealPath, :stat, :items, :newest, :fkind, :gfi_type, :gfi_attr, :gfi_created, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :thumb_tool, :icon_filename, :contents_filename)");
|
||||
$stmt = $dbo->prepare("INSERT INTO files VALUES (:pid, :fid, :Pathname, :Path, :Filename, :Extension, :Type, :Size, :Inode, :Perms, :Owner, :ATime, :MTime, :CTime, :LinkTarget, :RealPath, :stat, :items, :newest, :fkind, :gfi_type, :gfi_attr, :gfi_created, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :thumb_tool, :icon_filename, :icon_tool, :contents_filename)");
|
||||
|
||||
// Identify dir, file, link or bundle dir
|
||||
|
||||
@@ -880,9 +763,25 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
// Pool
|
||||
|
||||
if ($type == "file") {
|
||||
if ($type == "dir") {
|
||||
|
||||
unset($fetch_exif, $fetch_media, $fetch_hash, $fetch_thumb, $yes_exif, $yes_media, $yes_hash);
|
||||
unset($fetch_icon);
|
||||
|
||||
$fetch_icon = @$dbp->query("SELECT * FROM icons WHERE fid='".$pid."'")->fetch();
|
||||
if (@$fetch_icon['relative_path']) {
|
||||
$stmt->BindValue(":icon_filename",$fetch_icon['relative_path']);
|
||||
$stmt->BindValue(":icon_tool",$fetch_icon['tool']);
|
||||
}
|
||||
|
||||
} elseif ($type == "file") {
|
||||
|
||||
$fetch_icon = @$dbp->query("SELECT * FROM icons WHERE fid='".$fid."'")->fetch();
|
||||
if (@$fetch_icon['relative_path']) {
|
||||
$stmt->BindValue(":icon_filename",$fetch_icon['relative_path']);
|
||||
$stmt->BindValue(":icon_tool",$fetch_icon['tool']);
|
||||
}
|
||||
|
||||
unset($fetch_exif, $fetch_media, $fetch_hash, $fetch_thumb, $fetch_icon, $yes_exif, $yes_media, $yes_hash);
|
||||
|
||||
$yes_exif = $dbp->query("SELECT rowid FROM exiftool WHERE fid='".$fid."'")->fetch()[0];
|
||||
$stmt->BindValue(":has_exif",$yes_exif);
|
||||
@@ -896,9 +795,8 @@ foreach ($files as $splFileInfo) {
|
||||
$yes_contents = $dbp->query("SELECT relative_path FROM contents WHERE fid='".$fid."'")->fetch()[0];
|
||||
$stmt->BindValue(":contents_filename",$yes_contents);
|
||||
|
||||
if (!in_array($extension, $p['t_skip'])) {
|
||||
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$fid."'")->fetch();
|
||||
}
|
||||
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$fid."'")->fetch();
|
||||
|
||||
if (@$fetch_thumb['relative_path']) {
|
||||
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
|
||||
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
||||
@@ -907,30 +805,8 @@ foreach ($files as $splFileInfo) {
|
||||
} else {
|
||||
$stmt->BindValue(":thumb_filename",null);
|
||||
}
|
||||
|
||||
$fetch_icon = $dbp->query("SELECT * FROM icons WHERE fid='".$fid."'")->fetch();
|
||||
if (@$fetch_icon['relative_path']) {
|
||||
$stmt->BindValue(":icon_filename",$fetch_icon['relative_path']);
|
||||
} else {
|
||||
$stmt->BindValue(":icon_filename",null);
|
||||
}
|
||||
|
||||
} elseif ($type == "dir") {
|
||||
|
||||
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']);
|
||||
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
||||
$stmt->BindValue(":thumb_height",$fetch_thumb['height']);
|
||||
$stmt->BindValue(":thumb_tool",$fetch_thumb['tool']);
|
||||
} else {
|
||||
$stmt->BindValue(":thumb_filename",null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------ //
|
||||
|
||||
@@ -1109,7 +985,7 @@ while ($row_a = $loop->fetch()) {
|
||||
} elseif (!$found) {
|
||||
|
||||
// find a single value
|
||||
list($kind,$item) = explode("^",$dindex);
|
||||
list($kind,$item) = @explode("^",$dindex);
|
||||
if (@$m[$kind][$item]) {
|
||||
$stmt->BindValue(":".$name,@sanitize($m[$kind][$item],$type));
|
||||
$found = 1;
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.8.0.0
|
||||
0.8.0.1
|
||||
@@ -16,6 +16,7 @@ $bin_pngquant = escapeshellarg(__DIR__."/bin/pngquant");
|
||||
$bin_parallel = escapeshellarg(__DIR__."/bin/parallel");
|
||||
$bin_convert = escapeshellarg(__DIR__."/bin/convert");
|
||||
$bin_flacicon = escapeshellarg(__DIR__."/bin/flacicon");
|
||||
$bin_flacdiricon = escapeshellarg(__DIR__."/bin/flacdiricon");
|
||||
|
||||
// System tools
|
||||
$bin_php = "php";
|
||||
@@ -245,4 +246,47 @@ foreach ($p['t_skip'] as $ext) { $p['t_skip'][] = strtoupper($ext); }
|
||||
foreach ($p['i_skip'] as $ext) { $p['i_skip'][] = strtoupper($ext); }
|
||||
foreach ($p['p_files'] as $file) { $p['p_files'][] = strtoupper($file); }
|
||||
|
||||
// Spotlight //////////////////////////////////////////
|
||||
|
||||
$mb['i'] = array( "PixelWidth",
|
||||
"PixelHeight",
|
||||
"Latitude",
|
||||
"Longitude",
|
||||
"DurationSeconds",
|
||||
"UseCount",
|
||||
"FSInvisible",
|
||||
"NumberOfPages",
|
||||
"PageHeight",
|
||||
"PageWidth",
|
||||
"TotalBitRate" );
|
||||
|
||||
$mb['t'] = array( "Title",
|
||||
"ContentType",
|
||||
"Creator",
|
||||
"FSCreatorCode",
|
||||
"Kind",
|
||||
"FSTypeCode" );
|
||||
|
||||
$mb['a'] = array( "UserTags",
|
||||
"WhereFroms",
|
||||
"EncodingApplications" );
|
||||
|
||||
$mb['d'] = array( "DateAdded",
|
||||
"LastUsedDate",
|
||||
"ContentModificationDate",
|
||||
"ContentCreationDate" );
|
||||
|
||||
$ibuild[] = ":pid, :spotlight";
|
||||
$cbuild[] = "pid TEXT, spotlight TEXT";
|
||||
foreach (array_merge($mb['i'],$mb['d']) as $item) {
|
||||
$cbuild[] = $item." INTEGER";
|
||||
$ibuild[] = ":".$item;
|
||||
}
|
||||
foreach (array_merge($mb['t'],$mb['a']) as $item) {
|
||||
$cbuild[] = $item." TEXT";
|
||||
$ibuild[] = ":".$item;
|
||||
}
|
||||
|
||||
unset($item);
|
||||
|
||||
?>
|
||||
113
helper.php
113
helper.php
@@ -4,6 +4,9 @@
|
||||
// //
|
||||
//////////////////////////////////////////
|
||||
|
||||
ini_set('memory_limit', '10240M');
|
||||
date_default_timezone_set("America/Los_Angeles");
|
||||
|
||||
$prefs_file = "/Users/".get_current_user()."/Library/Preferences/org.profiteroles.Yuba.php";
|
||||
$p = unserialize(file_get_contents($prefs_file));
|
||||
|
||||
@@ -17,7 +20,7 @@ $dm = "";
|
||||
function dfm ($string, $flag = 0) {
|
||||
// dumb workaround for debug messages appearing out of order
|
||||
// uncomment next line to revert to instant message printing
|
||||
dm($string); return;
|
||||
//dm($string); return;
|
||||
|
||||
global $dm;
|
||||
if ($flag == 1) {
|
||||
@@ -29,13 +32,19 @@ function dfm ($string, $flag = 0) {
|
||||
}
|
||||
}
|
||||
|
||||
$fid = $argv[1];
|
||||
$pathname = $argv[2];
|
||||
$bdone = $argv[1];
|
||||
$btotal = $argv[2];
|
||||
$fid = $argv[3];
|
||||
$pathname = $argv[4];
|
||||
$pid = md5($pathname);
|
||||
$shellpath = escapeshellarg($pathname);
|
||||
$ext = pathinfo($pathname,PATHINFO_EXTENSION);
|
||||
$file = pathinfo($pathname, PATHINFO_BASENAME);
|
||||
$bpath = $argv[3];
|
||||
$mytime = $argv[4];
|
||||
$btype = $argv[5];
|
||||
$bpath = $argv[6];
|
||||
$mytime = $argv[7];
|
||||
|
||||
$parser = new plistParser();
|
||||
|
||||
$stamp = date("Y-m-d_H-i-s", $mytime);
|
||||
$messages_log_file = $bpath."/".$stamp."_messages.log";
|
||||
@@ -43,6 +52,20 @@ $messages_log_file = $bpath."/".$stamp."_messages.log";
|
||||
$tmpdir = "/tmp/yuba/".$mytime;
|
||||
if (!is_dir($tmpdir)) { mkdir($tmpdir,0777,true); dfm("mkdir ",$tmpdir); }
|
||||
|
||||
// Main DB
|
||||
|
||||
$dbo = new PDO("sqlite:".$bpath."/".$stamp.".sqlite3");
|
||||
$dbo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
|
||||
//$dbo->query("PRAGMA page_size = 4096");
|
||||
//$dbo->query("PRAGMA cache_size = 10000");
|
||||
//$dbo->query("PRAGMA locking_mode = EXCLUSIVE");
|
||||
//$dbo->query("PRAGMA synchronous = NORMAL");
|
||||
$dbo->query("PRAGMA journal_mode = WAL");
|
||||
|
||||
// Pool DB
|
||||
|
||||
$dbp = new PDO("sqlite:".$bpath."/pool.sqlite3");
|
||||
$dbp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbp->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
@@ -62,7 +85,7 @@ dfm("BATCH INIT ".$file.":".print_r($argv,true),2);
|
||||
// Thumbs //////////////////////////////////////////
|
||||
|
||||
thumbs:
|
||||
if ($p['thumbs']) {
|
||||
if ($p['thumbs'] && $btype == "file" && $ext != "DS_Store") {
|
||||
|
||||
dfm("THUMBS",1);
|
||||
|
||||
@@ -195,7 +218,7 @@ if ($p['thumbs']) {
|
||||
// Icons //////////////////////////////////////////
|
||||
|
||||
icons:
|
||||
if ($p['icons']) {
|
||||
if ($p['icons'] && ($btype == "file" || $btype == "dir") && $ext != "DS_Store") {
|
||||
|
||||
dfm("ICONS",1);
|
||||
|
||||
@@ -234,8 +257,7 @@ if ($p['icons']) {
|
||||
|
||||
}
|
||||
|
||||
$stmt->BindValue(":fid",$fid);
|
||||
|
||||
$cmd['flacdiricon'] = $bin_flacdiricon." ".$shellpath." ".$p['icon_size']." ".$tfile;
|
||||
$cmd['flacicon'] = $bin_flacicon." ".$shellpath." ".$p['icon_size']." ".$tfile;
|
||||
$cmd['ql-icon'] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." | ".$bin_pngquant." - -o ".$tfile;
|
||||
$cmd['qltool'] = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode | ".$bin_convert." - -scale 50% - | ".$bin_pngquant." - -o ".$tfile;
|
||||
@@ -267,16 +289,25 @@ if ($p['icons']) {
|
||||
|
||||
} else {
|
||||
|
||||
if ($ext == "flac") {
|
||||
$tools = array("flacicon","ql-icon","qltool");
|
||||
if ($btype == "dir") {
|
||||
$stmt->BindValue(":fid",$pid);
|
||||
$tools = array("flacdiricon","qltool");
|
||||
} else {
|
||||
$tools = array("ql-icon","qltool");
|
||||
$stmt->BindValue(":fid",$fid);
|
||||
if ($ext == "flac") {
|
||||
$tools = array("flacicon","ql-icon","qltool");
|
||||
} else {
|
||||
$tools = array("ql-icon","qltool");
|
||||
}
|
||||
}
|
||||
|
||||
unset($mytool);
|
||||
foreach ($tools as $tool) {
|
||||
if (!@filesize($tfile)) {
|
||||
shell_exec($cmd[$tool]." ".$redirect);
|
||||
dfm($cmd[$tool]);
|
||||
$estring .= " ->".$tool;
|
||||
$mytool = $tool;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,7 +340,7 @@ if ($p['icons']) {
|
||||
dfm("moving ".$tfile." to ".$dfile);
|
||||
$stmt->BindValue(":created",time());
|
||||
$stmt->BindValue(":relative_path",substr($dfile,strlen($bpath)));
|
||||
$stmt->BindValue(":tool",$tool);
|
||||
$stmt->BindValue(":tool",$mytool);
|
||||
$estring .= " ->use";
|
||||
|
||||
}
|
||||
@@ -317,7 +348,7 @@ if ($p['icons']) {
|
||||
} else {
|
||||
|
||||
$estring .= " ->discard";
|
||||
dfm($tool." produced a bad file (size=".$checksize.")");
|
||||
dfm($mytool." produced a bad file (size=".$checksize.")");
|
||||
|
||||
}
|
||||
|
||||
@@ -332,7 +363,7 @@ if ($p['icons']) {
|
||||
// Metadata //////////////////////////////////////////
|
||||
|
||||
meta:
|
||||
if ($p['meta']) {
|
||||
if ($p['meta'] && $btype == "file" && $ext != "DS_Store") {
|
||||
|
||||
dfm("META",1);
|
||||
|
||||
@@ -389,7 +420,7 @@ if ($p['meta']) {
|
||||
// Hash //////////////////////////////////////////
|
||||
|
||||
hashy:
|
||||
if ($p['hash']) {
|
||||
if ($p['hash'] && $btype == "file" && $ext != ".DS_Store") {
|
||||
|
||||
dfm("HASH",1);
|
||||
|
||||
@@ -423,7 +454,7 @@ if ($p['hash']) {
|
||||
// Contents //////////////////////////////////////////
|
||||
|
||||
contents:
|
||||
if ($p['contents']) {
|
||||
if ($p['contents'] && $btype == "file") {
|
||||
|
||||
dfm("CONTENTS",1);
|
||||
|
||||
@@ -463,6 +494,53 @@ if ($p['contents']) {
|
||||
}
|
||||
}
|
||||
|
||||
// Spotlight //////////////////////////////////////////
|
||||
|
||||
if ($p['spotlight']) {
|
||||
|
||||
dfm("SPOTLIGHT",1);
|
||||
$estring .= " SPOTLIGHT";
|
||||
|
||||
$cmd = "mdls -plist - ".$shellpath." ".$redirect;
|
||||
dfm($cmd);
|
||||
$mdls = shell_exec($cmd);
|
||||
|
||||
if (substr_count(@$mdls,"\n") > 1) {
|
||||
$spotlight = $parser->parseString(utf8_for_xml($mdls));
|
||||
} else {
|
||||
$spotlight = array();
|
||||
}
|
||||
|
||||
$stmt = $dbo->prepare("INSERT INTO mdls VALUES (:id,".implode(",",$ibuild).")");
|
||||
$stmt->BindValue(":id",$bdone+1);
|
||||
|
||||
foreach ($mb as $key => $list) {
|
||||
foreach ($list as $item) {
|
||||
|
||||
if (@$spotlight["kMDItem".$item]) {
|
||||
$stmt->BindValue(":pid",$pid);
|
||||
$stmt->BindValue(":spotlight",$mdls);
|
||||
switch($key) {
|
||||
case "i":
|
||||
case "t":
|
||||
$stmt->BindValue(":".$item,$spotlight["kMDItem".$item]);
|
||||
break;
|
||||
case "a":
|
||||
$stmt->BindValue(":".$item,serialize($spotlight["kMDItem".$item]));
|
||||
break;
|
||||
case "d":
|
||||
$stmt->BindValue(":".$item,strtotime($spotlight["kMDItem".$item]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$estring .= " ->db";
|
||||
$stmt->execute();
|
||||
|
||||
}
|
||||
|
||||
// Inserts //////////////////////////////////////////
|
||||
|
||||
dfm("SQL",1);
|
||||
@@ -471,5 +549,6 @@ foreach ($sbatch as $stmt) { $stmt->execute(); dfm($stmt->queryString); }
|
||||
|
||||
dm($dm);
|
||||
echo msg($estring,false);
|
||||
echo "\n"."PROGRESS:".round(($bdone/$btotal)*100,2)."\n";
|
||||
|
||||
?>
|
||||
58
web/rtc.php
58
web/rtc.php
@@ -4,7 +4,7 @@
|
||||
// Yuba RTC Browser
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
$browser_version = "0.7.13.2";
|
||||
$browser_version = "0.8.0.1";
|
||||
|
||||
require "togggle.php";
|
||||
require "lib/ref/ref.php";
|
||||
@@ -25,7 +25,7 @@ $hidefiles = array(".DS_Store");
|
||||
<meta charset='UTF-8'>
|
||||
<style>
|
||||
|
||||
html { font-family: Helvetica; word-wrap: break-all; word-break: break-all; }
|
||||
html { font-family: Helvetica; word-wrap: break; word-break: break; }
|
||||
|
||||
table.outlined tbody > tr > td > div { outline: 1px solid purple; }
|
||||
table.outlined tbody > tr > td > div > div { outline: 1px solid orange; }
|
||||
@@ -346,7 +346,7 @@ function mb_shortlabel($filename, $max = 40) {
|
||||
}
|
||||
|
||||
function findicon($filename) {
|
||||
$ext = pathinfo($filename)['extension'];
|
||||
$ext = @pathinfo($filename)['extension'];
|
||||
$good = "yicons/null.png";
|
||||
foreach (glob("yicons/*.png") as $file) {
|
||||
if (pathinfo($file)['filename'] == $ext) {
|
||||
@@ -379,16 +379,14 @@ if ($db_file) {
|
||||
$zpath = $dbo->query("SELECT zpath FROM _skim")->fetch()['zpath'];
|
||||
$skim_version = $dbo->query("SELECT version FROM _skim")->fetch()['version'];
|
||||
|
||||
$spotlight_status = $dbo->query("SELECT mdutil FROM _skim")->fetch()['mdutil'];
|
||||
|
||||
// Check for initial view
|
||||
|
||||
$view = $dbo->query("SELECT * FROM _skim")->fetch();
|
||||
$myopts = $view['opts'] = unserialize($view['opts']);
|
||||
|
||||
if (!$pid) {
|
||||
$pid = $dbo->query("SELECT pid FROM family WHERE (rowid=2)")->fetch()['pid'];
|
||||
// handle special strings
|
||||
$view['opts'] = unserialize($view['opts']);
|
||||
if (is_serial($view['qlmanage'])) {
|
||||
$view['qlmanage'] = unserialize($view['qlmanage']);
|
||||
} else {
|
||||
@@ -420,7 +418,7 @@ if ($db_file) {
|
||||
if (is_serial($view['stat'])) {
|
||||
$view['stat'] = unserialize($view['stat']);
|
||||
}
|
||||
if (!strpos($spotlight_status,"disabled")) {
|
||||
if ($myopts['spotlight']) {
|
||||
$dirmdls = $dbo->query("SELECT rowid, * FROM mdls WHERE (rowid='".$view['rowid']."')")->fetch();
|
||||
}
|
||||
}
|
||||
@@ -477,7 +475,6 @@ if ($db_file) {
|
||||
// File view
|
||||
|
||||
$skim_version = $dbo->query("SELECT version FROM _skim")->fetch()['version'];
|
||||
$spotlight_status = $dbo->query("SELECT mdutil FROM _skim")->fetch()['mdutil'];
|
||||
|
||||
$row_a = $dbo->query("SELECT rowid, * FROM files WHERE (pid='".$pid."')")->fetch();
|
||||
if (!$row_a) { // this file doesn't exist in this version of the db
|
||||
@@ -491,7 +488,7 @@ if ($db_file) {
|
||||
$row_a['stat'] = unserialize($row_a['stat']);
|
||||
}
|
||||
|
||||
if (!strpos($spotlight_status,"disabled")) {
|
||||
if ($myopts['spotlight']) {
|
||||
|
||||
$row_b = $dbo->query("SELECT * FROM mdls WHERE (rowid='".$row_a['rowid']."')")->fetch();
|
||||
$row_e = @$dbo->query("SELECT * FROM milk WHERE (rowid='".$row_a['rowid']."')")->fetch();
|
||||
@@ -551,7 +548,7 @@ if ($db_file) {
|
||||
$qlm = unserialize($qlm);
|
||||
$mytype = @$qlm['plugins'][@$row_b['ContentType']];
|
||||
if (!empty($mytype)) {
|
||||
echo "<br><br>QLGenerator used = ".$mytype."<br><br>";
|
||||
echo "<br><br>QLGenerator delegate = ".$mytype."<br><br>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,9 +671,8 @@ if ($db_file) {
|
||||
//echo "<table class='dir outlined'><tr><td valign='top'>";
|
||||
echo "<table class='dir'><tr><td valign='top'>";
|
||||
echo "<div class='container'>";
|
||||
|
||||
$spotlight_status = $dbo->query("SELECT mdutil FROM _skim")->fetch()['mdutil'];
|
||||
if (!strpos($spotlight_status,"disabled")) {
|
||||
|
||||
if ($myopts['spotlight']) {
|
||||
|
||||
$sql = "SELECT mdls.*, files.*, milk.* FROM files ";
|
||||
$sql .= "LEFT JOIN mdls ON (files.rowid = mdls.rowid) ";
|
||||
@@ -711,20 +707,10 @@ if ($db_file) {
|
||||
$visibility = "unhidden";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// hack to preview mixed icon/thumb view
|
||||
$opts = unserialize($dbo->query("SELECT opts FROM _skim")->fetch()['opts']);
|
||||
//$skipicon = array("jpg","png","JPG","jpeg","tif","tiff","DNG","dng","NEF");
|
||||
$skipicon = array();
|
||||
if($item['icon_filename'] && !in_array($item['Extension'],$skipicon)) {
|
||||
$item['thumb_filename'] = $item['icon_filename'];
|
||||
$item['thumb_width'] = $opts['thumb_size'];
|
||||
$item['thumb_height'] = $opts['thumb_size'];
|
||||
$item['thumb_tool'] = "qltool";
|
||||
}
|
||||
////////////////////////////////////////////////
|
||||
|
||||
if ($item['thumb_filename']) {
|
||||
if (@$item['icon_filename']) {
|
||||
$realfile = dirname($db_file).$item['icon_filename'];
|
||||
$icon = "<img class='lazyload' data-src='".$realfile."' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
||||
} elseif (@$item['thumb_filename']) {
|
||||
$aspect = $item['thumb_width']/$item['thumb_height'];
|
||||
if ($aspect > 1) {
|
||||
$width = $icon_size;
|
||||
@@ -733,22 +719,8 @@ if ($db_file) {
|
||||
$width = $icon_size*$aspect;
|
||||
$height = $icon_size;
|
||||
}
|
||||
if ($item['Type'] == "dir") {
|
||||
$width = $width/2;
|
||||
$height = $height/2;
|
||||
}
|
||||
$realfile = dirname($db_file).$item['thumb_filename'];
|
||||
if (array_key_exists("thumb_tool",$item)) {
|
||||
if (in_array($item['thumb_tool'], $border_tools) && $item['Type'] != "dir") {
|
||||
// put a border around images that are not icons
|
||||
$border = "id='thumb'";
|
||||
} else {
|
||||
$border = "";
|
||||
}
|
||||
} else {
|
||||
$border = "id='thumb'";
|
||||
}
|
||||
$icon = "<img ".$border." class='lazyload' data-src='".$realfile."' width='".$width."' height='".$height."' data-width='".$width."' data-height='".$height."'>";
|
||||
$icon = "<img id='thumb' class='lazyload' data-src='".$realfile."' width='".$width."' height='".$height."' data-width='".$width."' data-height='".$height."'>";
|
||||
} elseif ($item['Type'] == "dir") {
|
||||
$icon = "<img src='/yicons/directory.png' width='".$icon_size."' height='".$icon_size."' data-width='".$icon_size."' data-height='".$icon_size."'>";
|
||||
} else {
|
||||
@@ -907,7 +879,7 @@ if ($db_file) {
|
||||
echo number_format($info['passed_total'])." files, ";
|
||||
if ($info['image_file']) { echo $info['image_file'].", "; }
|
||||
echo $status;
|
||||
if (strpos($info['mdutil'],"disabled")) { echo " (no spotlight)"; }
|
||||
if (strpos($info['mdutil'],"disabled")) { echo " (volume has spotlight disabled)"; }
|
||||
echo "</div>";
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
Reference in New Issue
Block a user