0.7.6
This commit is contained in:
68
Yuba.php
68
Yuba.php
@@ -3,11 +3,10 @@
|
||||
// Yuba
|
||||
// //
|
||||
//////////////////////////////////////////
|
||||
$version = "0.7.5";
|
||||
$version = "0.7.6";
|
||||
|
||||
ini_set('memory_limit', '4096M');
|
||||
date_default_timezone_set("America/Los_Angeles");
|
||||
$time_start = microtime(true);
|
||||
|
||||
// Includes & Prefs
|
||||
//////////////////////////////////////////
|
||||
@@ -16,6 +15,8 @@ require("functions.php");
|
||||
require("filetypes.php");
|
||||
|
||||
$wopt_noprofile = 1;
|
||||
$wopt_steps = 9;
|
||||
$wopt_currstep = 1;
|
||||
|
||||
$p = unserialize(file_get_contents("prefs.php"));
|
||||
|
||||
@@ -97,9 +98,9 @@ echo "Gathering system info...\n";
|
||||
$host = gethostname();
|
||||
$disks = shell_exec("diskutil list 2>&1");
|
||||
$df = shell_exec("df 2>&1");
|
||||
$df_volume = shell_exec("df ".$zpath." | tail -n 1 | rev | cut -d' ' -f1 | rev");
|
||||
$df_device = shell_exec("df ".$zpath." | tail -n 1 | cut -d' ' -f1");
|
||||
$mdutil = shell_exec("mdutil -s ".$df_volume);
|
||||
$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 ".escapeshellarg($df_volume));
|
||||
if (strpos($mdutil,"disabled")) {
|
||||
echo "Warning: spotlight indexing is disabled\n";
|
||||
$p['spotlight'] = false;
|
||||
@@ -343,7 +344,7 @@ $family = array();
|
||||
$fids = array();
|
||||
$noread = array();
|
||||
|
||||
echo ProgressBar::start($passed_total,"Prescan");
|
||||
echo ProgressBar::start($passed_total,"Prescan (".stepString().")");
|
||||
|
||||
foreach ($files as $splFileInfo) {
|
||||
|
||||
@@ -397,7 +398,7 @@ foreach ($files as $splFileInfo) {
|
||||
//$family[$pkey]['children'][] = $key;
|
||||
$family[$pkey]['children'][] = $i+1;
|
||||
|
||||
echo ProgressBar::next();
|
||||
echo ProgressBar::next(true);
|
||||
$i++;
|
||||
|
||||
}
|
||||
@@ -407,7 +408,7 @@ echo ProgressBar::finish();
|
||||
// Thow permissions error
|
||||
|
||||
if (count($noread)) {
|
||||
"Current user (".posix_getuid().") does not have read access to the following files:";
|
||||
echo "Current user (".posix_getuid().") does not have read access to the following files:\n";
|
||||
foreach ($noread as $file) {
|
||||
echo $file."\n";
|
||||
}
|
||||
@@ -471,15 +472,17 @@ $stmt .= "ignored=".$ignored.", ";
|
||||
$stmt .= "dupes=".($dupecount ? $dupecount : 0);
|
||||
$dbo->exec($stmt);
|
||||
|
||||
$wopt_currstep++;
|
||||
|
||||
// Contents
|
||||
//////////////////////////////////////////
|
||||
|
||||
if ($p['contents']) {
|
||||
|
||||
echo "DO CONTENTS HERE\n";
|
||||
// make a dir in the bundle called contents (similar to db)
|
||||
// make a dir in the bundle called contents (similar to thumbs)
|
||||
// match files smaller than x and with file extension of txt etc
|
||||
// copy files to hash dirs in bundle (like db dir)
|
||||
// copy files to hash dirs in bundle (like thumbs dir)
|
||||
|
||||
}
|
||||
|
||||
@@ -488,7 +491,7 @@ if ($p['contents']) {
|
||||
|
||||
if ($p['thumbs']) {
|
||||
|
||||
echo ProgressBar::start(count($fx),"Generating thumbnails");
|
||||
echo ProgressBar::start(count($fx),"Generating thumbnails (".stepString().")");
|
||||
|
||||
foreach ($fx as $array) {
|
||||
|
||||
@@ -566,7 +569,7 @@ if ($p['thumbs']) {
|
||||
|
||||
if ($p['meta']) {
|
||||
|
||||
echo ProgressBar::start(count($fx),"Collecting external metadata...");
|
||||
echo ProgressBar::start(count($fx),"Collecting external metadata (".stepString().")");
|
||||
|
||||
foreach ($fx as $array) {
|
||||
|
||||
@@ -580,19 +583,24 @@ if ($p['meta']) {
|
||||
echo ProgressBar::next("Not a media file: ".shortlabel($pathname));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (in_array($ext, $e_files)) {
|
||||
$check = $dbp->query("SELECT EXISTS(SELECT 1 FROM exiftool WHERE fid='".$fid."')")->fetch()[0];
|
||||
if (!$check) {
|
||||
$rawexif = eval("return ".`$bin_exiftool -php $shellpath`);
|
||||
$stmt = $dbp->prepare("INSERT INTO exiftool VALUES (:fid, :tags)");
|
||||
$stmt->BindValue(":fid",$fid);
|
||||
$stmt->BindValue(":tags",serialize($rawexif[0]));
|
||||
$stmt->execute();
|
||||
$found = 0;
|
||||
$arrstring = shell_exec($bin_exiftool." -php ".$shellpath);
|
||||
// $rawexif = eval("return ".`$bin_exiftool -php $shellpath`);
|
||||
// do an addtl check below to prevent "PHP Parse error: syntax error, unexpected end of file, expecting ';'"
|
||||
if (substr($arrstring,0,5) == "Array") {
|
||||
$rawexif = eval("return ".$arrstring);
|
||||
$stmt = $dbp->prepare("INSERT INTO exiftool VALUES (:fid, :tags)");
|
||||
$stmt->BindValue(":fid",$fid);
|
||||
$stmt->BindValue(":tags",serialize($rawexif[0]));
|
||||
$stmt->execute();
|
||||
$found = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (in_array($ext, $m_files)) {
|
||||
$check = $dbp->query("SELECT EXISTS(SELECT 1 FROM mediainfo WHERE fid='".$fid."')")->fetch()[0];
|
||||
if (!$check) {
|
||||
@@ -628,7 +636,7 @@ if ($p['hash']) {
|
||||
$message = "Generating hashes for all files";
|
||||
}
|
||||
|
||||
echo ProgressBar::start(count($fx),$message);
|
||||
echo ProgressBar::start(count($fx),$message." (".stepString().")");
|
||||
|
||||
foreach ($fx as $array) {
|
||||
$fid = $array[0];
|
||||
@@ -698,14 +706,15 @@ $p['spotlight'] = 1;
|
||||
|
||||
if ($p['spotlight']) {
|
||||
|
||||
echo ProgressBar::start($passed_total,"Spotlight");
|
||||
echo ProgressBar::start($passed_total,"Spotlight (".stepString().")");
|
||||
|
||||
$dbo->exec("CREATE TABLE mdls (".implode(",",$cbuild).")");
|
||||
|
||||
foreach ($files as $splFileInfo) {
|
||||
|
||||
$pid = md5($splFileInfo->getPathname());
|
||||
$shellpath = escapeshellarg($splFileInfo->getPathname());
|
||||
$path = $splFileInfo->getPathname();
|
||||
$pid = md5($path);
|
||||
$shellpath = escapeshellarg($path);
|
||||
$mdls = shell_exec("mdls -plist - ".$shellpath." 2>&1");
|
||||
if (substr_count(@$mdls,"\n") < 2) { continue; }
|
||||
|
||||
@@ -737,7 +746,7 @@ if ($p['spotlight']) {
|
||||
}
|
||||
|
||||
$stmt->execute();
|
||||
echo ProgressBar::next();
|
||||
echo ProgressBar::next(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -798,12 +807,10 @@ $stmt->execute();
|
||||
|
||||
$j = 0;
|
||||
|
||||
echo ProgressBar::start($passed_total,"Skimming");
|
||||
echo ProgressBar::start($passed_total, "Skimming");
|
||||
|
||||
foreach ($files as $splFileInfo) {
|
||||
|
||||
echo "\n";
|
||||
|
||||
// DB
|
||||
|
||||
$stmt = $dbo->prepare("INSERT INTO files VALUES (:pid, :fid, :Pathname, :Path, :Filename, :Extension, :Type, :Size, :Inode, :Perms, :Owner, :ATime, :CTime, :MTime, :LinkTarget, :RealPath, :stat, :items, :newest, :gfi_type, :gfi_attr, :gfi_created, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :has_contents, :contents_filename)");
|
||||
@@ -852,8 +859,6 @@ foreach ($files as $splFileInfo) {
|
||||
$stmt->BindValue(":CTime",$stx[$j][2]);
|
||||
|
||||
}
|
||||
|
||||
echo shortlabel($pathname,50);
|
||||
|
||||
// ------------------------------------------------ //
|
||||
|
||||
@@ -1005,8 +1010,7 @@ foreach ($files as $splFileInfo) {
|
||||
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
echo ProgressBar::next();
|
||||
echo ProgressBar::next($filename);
|
||||
$j++;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user