diff --git a/MainMenu.nib/designable.nib b/MainMenu.nib/designable.nib index 2f1894d..578d787 100644 --- a/MainMenu.nib/designable.nib +++ b/MainMenu.nib/designable.nib @@ -52,20 +52,21 @@ - + + - + - + - + - + @@ -74,7 +75,7 @@ - + - + - + - - - - - + + + + + - + - + + - + - + - + - + @@ -639,11 +489,11 @@ Gw - + - + @@ -657,36 +507,28 @@ Gw - + - + + - + - - + - + - + - + @@ -695,7 +537,7 @@ Gw - + @@ -706,12 +548,21 @@ Gw + - + diff --git a/MainMenu.nib/keyedobjects.nib b/MainMenu.nib/keyedobjects.nib index de94f15..7e12bed 100644 Binary files a/MainMenu.nib/keyedobjects.nib and b/MainMenu.nib/keyedobjects.nib differ diff --git a/Yuba.php b/Yuba.php index fe93cd7..0e302a2 100755 --- a/Yuba.php +++ b/Yuba.php @@ -3,7 +3,7 @@ // Yuba // // ////////////////////////////////////////// -$version = "0.7.9"; +$version = "0.7.9.3"; ini_set('memory_limit', '4096M'); date_default_timezone_set("America/Los_Angeles"); @@ -18,6 +18,8 @@ $wopt_noprofile = 0; $wopt_steps = 10; $wopt_currstep = 1; +$parser = new plistParser(); + $p = unserialize(file_get_contents("prefs.php")); // Path & application variables @@ -32,7 +34,7 @@ if (!is_dir($zpath) | !is_dir($bdest)) { echo "Filepath error"; die; } // Check for bundle if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); } -if (is_writable($zpath)) { echo "Warning: source is writeable"; } +if (is_writable($zpath)) { echo "Warning: source is writeable\n"; } $bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle"; if (!is_dir($bpath)) { mkdir($bpath); } @@ -97,17 +99,6 @@ echo msg($banner."\n".str_repeat("-", strlen($banner))); echo msg("Gathering system info..."); -$host = gethostname(); -$disks = shell_exec("diskutil list -plist 2>&1"); -$df = shell_exec("df 2>&1"); -$df_volume = shell_exec("df ".escapeshellarg($zpath)." | tail -n 1 | rev | cut -d' ' -f1 | rev"); -$df_device = shell_exec("df ".escapeshellarg($zpath)." | tail -n 1 | cut -d' ' -f1"); -$mdutil = shell_exec("mdutil -s ".$df_volume); -if (strpos($mdutil,"disabled")) { - echo msg("Warning: spotlight indexing is disabled"); - $p['spotlight'] = false; - } - if (substr($zpath, 0, 9) != "/Volumes/") { $zbase = "/"; } else { @@ -115,14 +106,36 @@ if (substr($zpath, 0, 9) != "/Volumes/") { $zbase = "/Volumes/".$zparts[2]; } -$hdiutil = shell_exec("hdiutil info -plist 2>&1"); +$host = gethostname(); +$disks = shell_exec("diskutil list -plist 2>&1"); +$diskutil = shell_exec("diskutil info -plist ".$zbase." 2>&1"); +$diskutil_parsed = $parser->parseString(utf8_for_xml($diskutil)); +//print_r($diskutil_parsed); +$vdisks = shell_exec("hdiutil info -plist 2>&1"); +$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")); + +$df_volume = $diskutil_parsed['MountPoint']; +$df_device = "/dev/".$diskutil_parsed['ParentWholeDisk']; + +$mdutil = shell_exec("mdutil -s ".$df_volume); +if (strpos($mdutil,"disabled")) { + echo msg("Warning: spotlight indexing is disabled"); + $p['spotlight'] = false; + } ///////////////////////////////////////////////////////////////////////////////////////////// // rewrite below to use diskutil info -plist // // // -$diskutil = shell_exec("diskutil info ".$zbase." 2>&1"); +$olddiskutil = shell_exec("diskutil info ".$zbase." 2>&1"); $getdetail = array( "Volume Name", "Protocol", "Volume UUID", @@ -132,7 +145,7 @@ $getdetail = array( "Volume Name", "Level Type" ); foreach ($getdetail as $detail) { - preg_match("/(".$detail.":)(.*)(\n)/",$diskutil,$matches); + preg_match("/(".$detail.":)(.*)(\n)/",$olddiskutil,$matches); if (isset($matches[2])) { if (substr($detail, -5, 5) == "Space") { $pieces = explode(" ", trim($matches[2])); @@ -162,9 +175,22 @@ if ($zpath == "/") { // ///////////////////////////////////////////////////////////////////////////////////////////// +if ($type == "Disk image") { + $hdiutil = shell_exec("hdiutil imageinfo -plist ".$df_device." 2>&1"); + foreach ($vdisks_parsed['images'] as $id => $disk) { + if ($disk['system-entities'][0]['dev-entry'] == $df_device) { + $image_file = $disk['image-path']; + } + } + } else { + $hdiutil = false; + $image_file = false; + } + if ($wopt_noprofile) { $profile = "disabled"; } else { + echo msg("system_profiler"); $profile = shell_exec("system_profiler SPHardwareDataType SPStorageDataType SPThunderboltDataType SPUSBDataType 2>&1"); } $qlmanage = shell_exec("qlmanage -m 2>&1"); @@ -203,13 +229,15 @@ $dbo->exec("CREATE TABLE _skim ( details TEXT, qlmanage TEXT, sysvers TEXT, - diskutil TEXT, - hdiutil TEXT, disks TEXT, - df TEXT, - df_device TEXT, - df_volume TEXT, - mdutil TEXT, + diskutil TEXT, + vdisks TEXT, + hdiutil TEXT, + image_file TEXT, + df TEXT, + df_device TEXT, + df_volume TEXT, + mdutil TEXT, profile TEXT, status TEXT )"); @@ -252,7 +280,7 @@ $dbo->exec("CREATE TABLE files ( contents_filename TEXT )"); -$stmt = $dbo->prepare("INSERT INTO _skim VALUES (:version, :opts, :host, :uid, :zpath, :bpath, :type, :passed_file, :passed_dir, :passed_link, :passed_total, :nodescended, :ignored, :dupes, :details, :qlmanage, :sysvers, :diskutil, :hdiutil, :disks, :df, :df_device, :df_volume, :mdutil, :profile, :status)"); +$stmt = $dbo->prepare("INSERT INTO _skim VALUES (:version, :opts, :host, :uid, :zpath, :bpath, :type, :passed_file, :passed_dir, :passed_link, :passed_total, :nodescended, :ignored, :dupes, :details, :qlmanage, :sysvers, :disks, :diskutil, :vdisks, :hdiutil, :image_file, :df, :df_device, :df_volume, :mdutil, :profile, :status)"); $stmt->BindValue(":version",$version); $stmt->BindValue(":opts",serialize($p)); $stmt->BindValue(":host",$host); @@ -263,9 +291,11 @@ $stmt->BindValue(":type",$type); $stmt->BindValue(":details",$dstring); $stmt->BindValue(":qlmanage",$qlmanage); $stmt->BindValue(":sysvers",$sysvers); -$stmt->BindValue(":diskutil",$diskutil); -$stmt->BindValue(":hdiutil",$hdiutil); $stmt->BindValue(":disks",$disks); +$stmt->BindValue(":diskutil",$diskutil); +$stmt->BindValue(":vdisks",$vdisks); +$stmt->BindValue(":hdiutil",$hdiutil); +$stmt->BindValue(":image_file",$image_file); $stmt->BindValue(":df",$df); $stmt->BindValue(":df_device",$df_device); $stmt->BindValue(":df_volume",$df_volume); @@ -480,6 +510,9 @@ foreach ($family as $key => $item) { echo ProgressBar::finish(); +// create an index for family db +$dbo->exec("CREATE INDEX family_index ON family (pid)"); + unset($dx, $dxo, $dupes); // stats @@ -781,7 +814,6 @@ if ($p['spotlight']) { $mdls = shell_exec("mdls -plist - ".$shellpath." 2>&1"); if (substr_count(@$mdls,"\n") > 1) { - $parser = new plistParser(); $spotlight = $parser->parseString(utf8_for_xml($mdls)); } else { $spotlight = array(); @@ -939,7 +971,7 @@ foreach ($files as $splFileInfo) { $stmt->BindValue(":gfi_type",$writegfitype); $stmt->BindValue(":gfi_attr",@$gfi['attributes']); - $stmt->BindValue(":gfi_created",strtotime($gfi['created'])); + $stmt->BindValue(":gfi_created",strtotime(@$gfi['created'])); // ------------------------------------------------ // @@ -1091,7 +1123,7 @@ while ($row_a = $loop->fetch()) { $m['m']['SkimTrackCount'] = @count($decoded['File']['track']); - @foreach ($decoded['File']['track'] as $track) { + 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"); } @@ -1174,7 +1206,8 @@ if ($p['rsync_dest']) { echo ProgressBar::finish(); } -echo msg("Finished in ".$seconds." seconds"); +$done = "Finished ".$zpath." in ".$seconds." seconds"; +echo msg($done); ncenter($done); unset($dbo, $dbp, $files, $family, $fx); diff --git a/filetypes.php b/filetypes.php index 5d3ccaa..926303b 100755 --- a/filetypes.php +++ b/filetypes.php @@ -3,13 +3,6 @@ // Filetypes ////////////////////////////////////////// -$c_files = array( "txt", - "rtf", - "rtfd", - "xls", - "log", - "webloc" ); - $t_files['ffmpeg'] = array( "mkv", "avi", "mpeg", diff --git a/functions.php b/functions.php index 60ac44a..8db4fe0 100755 --- a/functions.php +++ b/functions.php @@ -155,7 +155,7 @@ function human_filesize($bytes, $decimals = 2) { return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor]; } -function ncenter($string, $title = "DropToPTP") { +function ncenter($string, $title = "Skim") { exec("osascript -e 'display notification \"".$string."\" with title \"".$title."\"'"); } diff --git a/web/rtc.php b/web/rtc.php index 900b132..388c456 100644 --- a/web/rtc.php +++ b/web/rtc.php @@ -1,10 +1,10 @@ px; height: px; padding: px; } div.item { font-size: 11px; } @@ -224,13 +226,14 @@ if ($db_file) { if (!is_readable($db_file)) { echo "can't read db file"; die; } $dbo = new PDO("sqlite:".$db_file); - $dbx = new PDO("sqlite:".dirname($db_file)."/pool.sqlite3"); + $dbp = new PDO("sqlite:".dirname($db_file)."/pool.sqlite3"); $dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - $dbx->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); + $dbp->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); // Get zpath $zpath = $dbo->query("SELECT zpath FROM _skim")->fetch()['zpath']; + $skim_version = $dbo->query("SELECT version FROM _skim")->fetch()['version']; // Check for initial view @@ -322,18 +325,18 @@ if ($db_file) { // newer version stores rowid rather than 0 or 1 for has_exif etc if (isset($row_a['has_exif'])) { - $row_c = $dbx->query("SELECT * FROM exiftool WHERE (rowid='".$row_a['has_exif']."')")->fetch(); + $row_c = $dbp->query("SELECT * FROM exiftool WHERE (rowid='".$row_a['has_exif']."')")->fetch(); } if (isset($row_a['has_mediainfo'])) { - $row_d = $dbx->query("SELECT * FROM mediainfo WHERE (rowid='".$row_a['has_mediainfo']."')")->fetch(); + $row_d = $dbp->query("SELECT * FROM mediainfo WHERE (rowid='".$row_a['has_mediainfo']."')")->fetch(); } } else { // fetch exif and mediainfo by slower fid - $row_c = $dbx->query("SELECT * FROM exiftool WHERE (fid='".$row_a['fid']."')")->fetch(); - $row_d = $dbx->query("SELECT * FROM mediainfo WHERE (fid='".$row_a['fid']."')")->fetch(); + $row_c = $dbp->query("SELECT * FROM exiftool WHERE (fid='".$row_a['fid']."')")->fetch(); + $row_d = $dbp->query("SELECT * FROM mediainfo WHERE (fid='".$row_a['fid']."')")->fetch(); } @@ -583,7 +586,7 @@ if ($db_file) { echo number_format($info['passed_total'])." files, "; if ($info['image_file']) { echo $info['image_file'].", "; } echo $status; - if (strpos($info['spotlight_status'],"disabled")) { echo " (no spotlight)"; } + if (strpos($info['mdutil'],"disabled")) { echo " (no spotlight)"; } echo ""; } echo ""; @@ -592,7 +595,8 @@ if ($db_file) { ///////////////////////////////////////////////////////////////// -echo "

".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds"; +echo "
".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds
"; +echo "
Skim version = ".$skim_version.", RTC Browser Version = ".$browser_version."
"; ?>