This commit is contained in:
2019-04-27 00:48:25 -07:00
parent 9884d19108
commit 756ea17f99
5 changed files with 263 additions and 67 deletions

View File

@@ -3,9 +3,9 @@
// Yuba
// //
//////////////////////////////////////////
$version = "0.7.9.3";
$version = "0.7.10.3";
ini_set('memory_limit', '4096M');
ini_set('memory_limit', '10240M');
date_default_timezone_set("America/Los_Angeles");
// Includes & Prefs
@@ -62,6 +62,7 @@ foreach ($p['bundles'] as $bundle) {
// Ignore matching files and directories
$p['ignore'] = array( ".DS_Store",
".Trashes",
".DocumentRevisions-V100",
".Spotlight-V100",
".TemporaryItems",
@@ -116,7 +117,6 @@ $vdisks_parsed = $parser->parseString(utf8_for_xml($vdisks));
//print_r($vdisks_parsed);
$df = shell_exec("df 2>&1");
// old method, new method is to parse plist
//$df_volume = trim(shell_exec("df ".escapeshellarg($zpath)." | tail -n 1 | rev | cut -d' ' -f1 | rev"));
//$df_device = trim(shell_exec("df ".escapeshellarg($zpath)." | tail -n 1 | cut -d' ' -f1"));
@@ -124,7 +124,7 @@ $df = shell_exec("df 2>&1");
$df_volume = $diskutil_parsed['MountPoint'];
$df_device = "/dev/".$diskutil_parsed['ParentWholeDisk'];
$mdutil = shell_exec("mdutil -s ".$df_volume);
$mdutil = shell_exec("mdutil -sv ".$df_volume);
if (strpos($mdutil,"disabled")) {
echo msg("Warning: spotlight indexing is disabled");
$p['spotlight'] = false;
@@ -268,6 +268,7 @@ $dbo->exec("CREATE TABLE files (
stat TEXT,
items INTEGER,
newest INTEGER,
fkind TEXT,
gfi_type TEXT,
gfi_attr TEXT,
gfi_created TEXT,
@@ -767,7 +768,8 @@ $mb['i'] = array( "PixelWidth",
"FSInvisible",
"NumberOfPages",
"PageHeight",
"PageWidth" );
"PageWidth",
"TotalBitRate" );
$mb['t'] = array( "Title",
"ContentType",
@@ -863,7 +865,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, :gfi_type, :gfi_attr, :gfi_created, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :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, :contents_filename)");
// Identify dir, file, link or bundle dir
@@ -972,6 +974,17 @@ foreach ($files as $splFileInfo) {
$stmt->BindValue(":gfi_type",$writegfitype);
$stmt->BindValue(":gfi_attr",@$gfi['attributes']);
$stmt->BindValue(":gfi_created",strtotime(@$gfi['created']));
// ------------------------------------------------ //
// Kind
unset($fkind);
if ($type == "file") {
$fkind = trim(shell_exec("file -b -p ".$shellpath." | cut -f1 -d,"));
$stmt->BindValue(":fkind",@$fkind);
}
// ------------------------------------------------ //
@@ -1046,29 +1059,30 @@ echo ProgressBar::finish();
// Milk
//////////////////////////////////////////
$milk['t*Title'] = ["e^Title","k^Title","m^Track_name"];
$milk['t*DocTitle'] = ["e^Title","k^Title","m^Track_name"];
$milk['t*Format'] = ["m^Format","e^Compression","e^MIMEType"];
$milk['t*Dimensions'] = ["k^PixelWidth.k^PixelHeight","e^PixelWidth.e^PixelHeight","m^SkimDims"];
$milk['t*Dimensions'] = ["k^PixelWidth.k^PixelHeight","e^PixelWidth.e^PixelHeight","m^SkimDims","k^SkimPageDims"];
$milk['s*Seconds'] = ["k^DurationSeconds","e^Duration","m^Duration"];
$milk['d*DateTime'] = ["e^DateTimeOriginal","m^EncodedDate","e^CreateDate","e^MediaCreateDate","k^ContentCreationDate"];
$milk['t*Origin'] = ["e^CameraModelName","e^Producer","e^CreatorTool","e^WriterName","e^Software","e^Encoder","k^Creator"];
$milk['t*GPS'] = ["k^Latitude.k^Longitude","e^GPSPosition"];
$milk['t*Author'] = ["e^Author","e^Artist","e^Creator","e^By-line"];
$milk['t*Author'] = ["e^Author","e^Artist","e^Creator","e^By-line","k^Copyright"];
$milk['i*Tracks'] = ["m^SkimTrackCount"];
$milk['i*Tracks'] = ["m^SkimTrackCount","k^NumberOfPages"];
$milk['t*Writer'] = ["m^Writing_application.m^Writing_library"];
$milk['t*Bitrate'] = ["m^Overall_bit_rate"];
$milk['t*Bitrate'] = ["m^Overall_bit_rate","e^AvgBitrate","k^TotalBitRate"];
$milk['i*Orientation'] = ["e^Orientation"];
$milk['t*Profile'] = ["e^Profile"];
$milk['i*BitDepth'] = ["e^BitDepth"];
$milk['t*LensType'] = ["e^LensType"];
$milk['t*FocalLength'] = ["e^FocalLength"];
$milk['t*Aperture'] = ["e^Aperture"];
$milk['t*LightSource'] = ["e^LightSource"];
$milk['t*WhiteBalance'] = ["e^WhiteBalance"];
//$milk['i*Orientation'] = ["e^Orientation"];
//$milk['t*Profile'] = ["e^Profile"];
//$milk['i*BitDepth'] = ["e^BitDepth"];
//$milk['t*LensType'] = ["e^LensType"];
//$milk['t*FocalLength'] = ["e^FocalLength"];
//$milk['t*Aperture'] = ["e^Aperture"];
//$milk['t*LightSource'] = ["e^LightSource"];
//$milk['t*WhiteBalance'] = ["e^WhiteBalance"];
$delimiter = ",";
$display_delimiter = " x ";
// Build DB
@@ -1102,6 +1116,13 @@ while ($row_a = $loop->fetch()) {
$row_b = @$dbo->query("SELECT * FROM mdls WHERE (rowid='".$row_a['rowid']."')")->fetch();
if (count(@$row_b) > 1) {
$m['k'] = $row_b;
//custom values
if ($m['k']['PageWidth'] && $m['k']['PageHeight']) {
$m['k']['SkimPageDims'] = round($m['k']['PageWidth']/72,2)."in".$display_delimiter.round($m['k']['PageHeight']/72,2)."in";
}
} else {
$m['k'] = null;
}
@@ -1125,7 +1146,7 @@ while ($row_a = $loop->fetch()) {
foreach (@$decoded['File']['track'] as $track) {
if (!@$m['m']['SkimDims'] && @$track['Width'] && @$track['Height']) {
$m['m']['SkimDims'] = sanitize($track['Width'],"i").$delimiter.sanitize($track['Height'],"i");
$m['m']['SkimDims'] = sanitize($track['Width'],"i").$display_delimiter.sanitize($track['Height'],"i");
}
}