0.7.2
This commit is contained in:
260
Yuba.php
260
Yuba.php
@@ -3,7 +3,7 @@
|
|||||||
// Yuba
|
// Yuba
|
||||||
// //
|
// //
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
$version = "0.6.9";
|
$version = "0.7.2";
|
||||||
|
|
||||||
ini_set('memory_limit', '4096M');
|
ini_set('memory_limit', '4096M');
|
||||||
date_default_timezone_set("America/Los_Angeles");
|
date_default_timezone_set("America/Los_Angeles");
|
||||||
@@ -29,7 +29,7 @@ if (!is_dir($zpath) | !is_dir($bdest)) { echo "Filepath error"; die; }
|
|||||||
|
|
||||||
// Check for bundle
|
// Check for bundle
|
||||||
if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); }
|
if ($zpath == "/") { $blabel = "root"; } else { $blabel = preg_replace("/[^A-Za-z0-9\.]/", "_", basename($zpath)); }
|
||||||
if (is_writable($zpath)) { $p['paranoid'] = 1; } else { $p['paranoid'] = 0; }
|
if (is_writable($zpath)) { echo "Warning: source is writeable\n"; }
|
||||||
|
|
||||||
$bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle";
|
$bpath = chop($bdest,"/")."/".substr(crc32($zpath),0,3)."_".$blabel.".bundle";
|
||||||
if (!is_dir($bpath)) { mkdir($bpath); }
|
if (!is_dir($bpath)) { mkdir($bpath); }
|
||||||
@@ -73,6 +73,13 @@ $bin_exiftool = __DIR__."/bin/exiftool";
|
|||||||
$bin_ffmpeg = __DIR__."/bin/ffmpeg";
|
$bin_ffmpeg = __DIR__."/bin/ffmpeg";
|
||||||
$bin_qlthumb = __DIR__."/bin/ql-thumbnail";
|
$bin_qlthumb = __DIR__."/bin/ql-thumbnail";
|
||||||
|
|
||||||
|
// Logfile
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set("display_errors", TRUE);
|
||||||
|
ini_set("log_errors", TRUE);
|
||||||
|
ini_set("error_log", $bpath."/php.log");
|
||||||
|
|
||||||
// Banner
|
// Banner
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@@ -86,6 +93,13 @@ echo "Gathering system info...\n";
|
|||||||
|
|
||||||
$host = gethostname();
|
$host = gethostname();
|
||||||
$disks = shell_exec("diskutil list 2>&1");
|
$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);
|
||||||
|
if (strpos($mdutil,"disabled")) {
|
||||||
|
echo "Warning: spotlight indexing is disabled\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (substr($zpath, 0, 9) != "/Volumes/") {
|
if (substr($zpath, 0, 9) != "/Volumes/") {
|
||||||
$zbase = "/";
|
$zbase = "/";
|
||||||
@@ -175,6 +189,10 @@ $dbo->exec("CREATE TABLE _walkwalk (
|
|||||||
sysvers TEXT,
|
sysvers TEXT,
|
||||||
diskutil TEXT,
|
diskutil TEXT,
|
||||||
disks TEXT,
|
disks TEXT,
|
||||||
|
df TEXT,
|
||||||
|
df_device TEXT,
|
||||||
|
df_volume TEXT,
|
||||||
|
mdutil TEXT,
|
||||||
profile TEXT,
|
profile TEXT,
|
||||||
status TEXT
|
status TEXT
|
||||||
)");
|
)");
|
||||||
@@ -185,100 +203,6 @@ $dbo->exec("CREATE TABLE family (
|
|||||||
children TEXT
|
children TEXT
|
||||||
)");
|
)");
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Gather for each file:
|
|
||||||
|
|
||||||
A. IDs
|
|
||||||
|
|
||||||
pid (path ID)
|
|
||||||
fid (file ID)
|
|
||||||
|
|
||||||
B. splFileInfo methods
|
|
||||||
|
|
||||||
Pathname
|
|
||||||
Path
|
|
||||||
Filename
|
|
||||||
Extension
|
|
||||||
Type
|
|
||||||
Inode
|
|
||||||
Perms
|
|
||||||
Owner
|
|
||||||
ATime
|
|
||||||
CTime
|
|
||||||
MTime
|
|
||||||
LinkTarget
|
|
||||||
RealPath
|
|
||||||
|
|
||||||
C. External methods
|
|
||||||
|
|
||||||
stat
|
|
||||||
items
|
|
||||||
newest
|
|
||||||
gfi_type
|
|
||||||
gfi_attr
|
|
||||||
gfi_created
|
|
||||||
|
|
||||||
D. Aggregates
|
|
||||||
|
|
||||||
Size (splFileInfo, du)
|
|
||||||
Title (exiftool, kMDItemTitle, mediainfo)
|
|
||||||
PixelWidth (kMDItemPixelWidth, exiftool, mediainfo)
|
|
||||||
PixelHeight (kMDItemPixelHeight, exiftool, mediainfo)
|
|
||||||
Duration (kMDItemDurationSeconds, mediainfo, exiftool)
|
|
||||||
DateTimeOriginal (exiftool[DateTimeOriginal],mediainfo[EncodedDate],exiftool[CreateDate,MediaCreateDate],kMDItemContentCreationDate)
|
|
||||||
Origin (exiftool[CameraModelName,Producer,CreatorTool,WriterName,Software,Encoder],mediainfo[WritingApplication])
|
|
||||||
GPS (exiftool[GPSPosition], kMDItemLatitude.kMDItemLongitude)
|
|
||||||
Author (exiftool[Author,Artist,Creator,By-line])
|
|
||||||
|
|
||||||
E. Spotlight
|
|
||||||
|
|
||||||
spotlight (whole plist)
|
|
||||||
kMDItemDateAdded
|
|
||||||
kMDItemLastUsedDate
|
|
||||||
kMDItemUseCount
|
|
||||||
kMDItemContentModificationDate
|
|
||||||
kMDItemContentType
|
|
||||||
kMDItemCreator
|
|
||||||
kMDItemFSCreatorCode
|
|
||||||
kMDItemKind
|
|
||||||
kMDItemFSTypeCode
|
|
||||||
kMDItemUserTags
|
|
||||||
kMDItemFSInvisible
|
|
||||||
kMDItemNumberOfPages
|
|
||||||
kMDItemPageHeight
|
|
||||||
kMDItemPageWidth
|
|
||||||
kMDItemWhereFroms
|
|
||||||
kMDItemEncodingApplications
|
|
||||||
|
|
||||||
F. Pool
|
|
||||||
|
|
||||||
has_exif
|
|
||||||
has_mediainfo
|
|
||||||
has_hash
|
|
||||||
thumb_filename
|
|
||||||
thumb_width
|
|
||||||
thumb_height
|
|
||||||
|
|
||||||
G. Exiftool
|
|
||||||
|
|
||||||
ProfileDescription
|
|
||||||
BitDepth
|
|
||||||
Compression
|
|
||||||
WhiteBalance
|
|
||||||
Orientation
|
|
||||||
LensType
|
|
||||||
|
|
||||||
H. Mediainfo
|
|
||||||
|
|
||||||
VideoFormat
|
|
||||||
AudioFormat
|
|
||||||
Tracks
|
|
||||||
Profile
|
|
||||||
Bitrate
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
$dbo->exec("CREATE TABLE files (
|
$dbo->exec("CREATE TABLE files (
|
||||||
pid TEXT,
|
pid TEXT,
|
||||||
fid TEXT,
|
fid TEXT,
|
||||||
@@ -345,7 +269,7 @@ $dbo->exec("CREATE TABLE files (
|
|||||||
Bitrate INTEGER
|
Bitrate INTEGER
|
||||||
)");
|
)");
|
||||||
|
|
||||||
$stmt = $dbo->prepare("INSERT INTO _walkwalk VALUES (:version, :opts, :host, :uid, :zpath, :bpath, :type, :passed_file, :passed_dir, :passed_link, :passed_total, :nodescended, :ignored, :dupes, :stats, :qlmanage, :sysvers, :diskutil, :disks, :profile, :status)");
|
$stmt = $dbo->prepare("INSERT INTO _walkwalk VALUES (:version, :opts, :host, :uid, :zpath, :bpath, :type, :passed_file, :passed_dir, :passed_link, :passed_total, :nodescended, :ignored, :dupes, :stats, :qlmanage, :sysvers, :diskutil, :disks, :df, :df_device, :df_volume, :mdutil, :profile, :status)");
|
||||||
$stmt->BindValue(":version",$version);
|
$stmt->BindValue(":version",$version);
|
||||||
$stmt->BindValue(":opts",serialize($p));
|
$stmt->BindValue(":opts",serialize($p));
|
||||||
$stmt->BindValue(":host",$host);
|
$stmt->BindValue(":host",$host);
|
||||||
@@ -358,6 +282,10 @@ $stmt->BindValue(":qlmanage",$qlmanage);
|
|||||||
$stmt->BindValue(":sysvers",$sysvers);
|
$stmt->BindValue(":sysvers",$sysvers);
|
||||||
$stmt->BindValue(":diskutil",$diskutil);
|
$stmt->BindValue(":diskutil",$diskutil);
|
||||||
$stmt->BindValue(":disks",$disks);
|
$stmt->BindValue(":disks",$disks);
|
||||||
|
$stmt->BindValue(":df",$df);
|
||||||
|
$stmt->BindValue(":df_device",$df_device);
|
||||||
|
$stmt->BindValue(":df_volume",$df_volume);
|
||||||
|
$stmt->BindValue(":mdutil",$mdutil);
|
||||||
$stmt->BindValue(":profile",$profile);
|
$stmt->BindValue(":profile",$profile);
|
||||||
$stmt->BindValue(":status","aborted");
|
$stmt->BindValue(":status","aborted");
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@@ -418,53 +346,45 @@ $files = new RecursiveIteratorIterator(
|
|||||||
foreach ($files as $null) { }
|
foreach ($files as $null) { }
|
||||||
$first_run = 0;
|
$first_run = 0;
|
||||||
|
|
||||||
// Permissions
|
// Permissions & Stat
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
if (posix_getuid()) {
|
echo ProgressBar::start($passed_total,"Stat");
|
||||||
|
|
||||||
echo ProgressBar::start($passed_total,"File permissions");
|
$i = 0;
|
||||||
|
$noread = array();
|
||||||
|
foreach ($files as $splFileInfo) {
|
||||||
|
|
||||||
echo "You are not root. Checking file readability";
|
$shellpath = escapeshellarg($splFileInfo->getPathname());
|
||||||
|
$realpath = $splFileInfo->getRealPath();
|
||||||
|
|
||||||
$oops = 0;
|
if ($splFileInfo->getType() != "link") {
|
||||||
foreach ($files as $splFileInfo) {
|
$stx[$i] = array( $splFileInfo->getATime(),
|
||||||
$path = $splFileInfo->getRealPath();
|
$splFileInfo->getMTime(),
|
||||||
if ($path && !is_readable($path)) {
|
$splFileInfo->getCTime() );
|
||||||
$oops = 1;
|
|
||||||
echo "x";
|
|
||||||
} else {
|
|
||||||
echo ".";
|
|
||||||
}
|
}
|
||||||
|
$sty[$i] = chop(shell_exec("stat -x ".$shellpath." 2>&1"));
|
||||||
|
|
||||||
|
if ($realpath && !is_readable($realpath)) {
|
||||||
|
$noread[] = $realpath;
|
||||||
|
}
|
||||||
|
|
||||||
echo ProgressBar::next();
|
echo ProgressBar::next();
|
||||||
//echo "\t".$path."\n";
|
$i++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ProgressBar::finish();
|
if (count($noread)) {
|
||||||
|
foreach ($noread as $file) {
|
||||||
echo "\n";
|
echo "Current user (".posix_getuid().") does not have read access to ".$file."\n";
|
||||||
|
}
|
||||||
if ($oops) {
|
if ($p['readability']) {
|
||||||
echo "Some files could not be read. Stopping.";
|
echo "Exiting...";
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
echo "Running as root. Some QuickLook plugins may not be available.";
|
|
||||||
echo "\n";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($p['paranoid']) {
|
echo ProgressBar::finish();
|
||||||
echo "Filesystem is writable. ";
|
|
||||||
if ($p['fixatimes']) {
|
|
||||||
echo "Preserving atimes.";
|
|
||||||
} else {
|
|
||||||
echo "Preserving ctimes.";
|
|
||||||
}
|
|
||||||
echo "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pool DB
|
// Pool DB
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@@ -475,6 +395,7 @@ $dbp->exec("CREATE TABLE IF NOT EXISTS md5 (fid TEXT, hash TEXT)");
|
|||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS exiftool (fid TEXT, tags TEXT)");
|
$dbp->exec("CREATE TABLE IF NOT EXISTS exiftool (fid TEXT, tags TEXT)");
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS mediainfo (fid TEXT, info TEXT)");
|
$dbp->exec("CREATE TABLE IF NOT EXISTS mediainfo (fid TEXT, info TEXT)");
|
||||||
$dbp->exec("CREATE TABLE IF NOT EXISTS thumbs (fid TEXT, created INTEGER, relative_path TEXT, width INTEGER, height INTEGER, tool TEXT)");
|
$dbp->exec("CREATE TABLE IF NOT EXISTS thumbs (fid TEXT, created INTEGER, relative_path TEXT, width INTEGER, height INTEGER, tool TEXT)");
|
||||||
|
$dbp->exec("CREATE TABLE IF NOT EXISTS contents (fid TEXT, created INTEGER, relative_path TEXT)");
|
||||||
|
|
||||||
// Prescan
|
// Prescan
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@@ -577,6 +498,15 @@ $stmt .= "ignored=".$ignored.", ";
|
|||||||
$stmt .= "dupes=".($dupecount ? $dupecount : 0);
|
$stmt .= "dupes=".($dupecount ? $dupecount : 0);
|
||||||
$dbo->exec($stmt);
|
$dbo->exec($stmt);
|
||||||
|
|
||||||
|
// Contents
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
if ($p['contents']) {
|
||||||
|
|
||||||
|
echo "DO CONTENTS HERE\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Thumbnails
|
// Thumbnails
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@@ -742,7 +672,9 @@ if ($p['hash']) {
|
|||||||
// Files
|
// Files
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
echo ProgressBar::start($passed_total,"Processing files");
|
$j = 0;
|
||||||
|
|
||||||
|
echo ProgressBar::start($passed_total,"Skimming");
|
||||||
|
|
||||||
foreach ($files as $splFileInfo) {
|
foreach ($files as $splFileInfo) {
|
||||||
|
|
||||||
@@ -764,10 +696,6 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
$stmt->BindValue(":Type",$type);
|
$stmt->BindValue(":Type",$type);
|
||||||
|
|
||||||
// Cache atime before it gets modified
|
|
||||||
|
|
||||||
if ($type != "link") { $atime = $splFileInfo->getATime(); }
|
|
||||||
|
|
||||||
// Path basics
|
// Path basics
|
||||||
|
|
||||||
$pathname = $splFileInfo->getPathname();
|
$pathname = $splFileInfo->getPathname();
|
||||||
@@ -781,6 +709,8 @@ foreach ($files as $splFileInfo) {
|
|||||||
$stmt->BindValue(":Filename",$filename);
|
$stmt->BindValue(":Filename",$filename);
|
||||||
$stmt->BindValue(":Extension",$extension);
|
$stmt->BindValue(":Extension",$extension);
|
||||||
|
|
||||||
|
$stmt->BindValue(":stat",$sty[$j]);
|
||||||
|
|
||||||
if ($type == "link") {
|
if ($type == "link") {
|
||||||
|
|
||||||
$stmt->BindValue(":LinkTarget",$splFileInfo->getLinkTarget());
|
$stmt->BindValue(":LinkTarget",$splFileInfo->getLinkTarget());
|
||||||
@@ -792,9 +722,9 @@ foreach ($files as $splFileInfo) {
|
|||||||
$stmt->BindValue(":Perms",$splFileInfo->getPerms());
|
$stmt->BindValue(":Perms",$splFileInfo->getPerms());
|
||||||
$stmt->BindValue(":Owner",$splFileInfo->getOwner().":".$splFileInfo->getGroup());
|
$stmt->BindValue(":Owner",$splFileInfo->getOwner().":".$splFileInfo->getGroup());
|
||||||
|
|
||||||
$stmt->BindValue(":ATime",$atime);
|
$stmt->BindValue(":ATime",$stx[$j][0]);
|
||||||
$stmt->BindValue(":CTime",$splFileInfo->getCTime());
|
$stmt->BindValue(":MTime",$stx[$j][1]);
|
||||||
$stmt->BindValue(":MTime",$splFileInfo->getMTime());
|
$stmt->BindValue(":CTime",$stx[$j][2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,29 +732,6 @@ foreach ($files as $splFileInfo) {
|
|||||||
|
|
||||||
// ------------------------------------------------ //
|
// ------------------------------------------------ //
|
||||||
|
|
||||||
// Get stat
|
|
||||||
|
|
||||||
if ($type != "link") {
|
|
||||||
$stat = chop(@shell_exec("stat -x ".$shellpath." 2>&1"));
|
|
||||||
} else {
|
|
||||||
$stat = null;
|
|
||||||
}
|
|
||||||
$stmt->BindValue(":stat",@$stat);
|
|
||||||
|
|
||||||
// Cache stat
|
|
||||||
|
|
||||||
if ($type != "link" && $p['paranoid']) {
|
|
||||||
$pre_access = null;
|
|
||||||
$pre_modify = null;
|
|
||||||
$pre_change = null;
|
|
||||||
foreach (explode("\n", $stat) as $line) {
|
|
||||||
$check = substr($line, 0, 6);
|
|
||||||
if ($check == "Access") { $pre_access = $line; }
|
|
||||||
if ($check == "Modify") { $pre_modify = $line; }
|
|
||||||
if ($check == "Change") { $pre_change = $line; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate PID and FID
|
// Generate PID and FID
|
||||||
|
|
||||||
$pid = md5($pathname);
|
$pid = md5($pathname);
|
||||||
@@ -895,6 +802,7 @@ foreach ($files as $splFileInfo) {
|
|||||||
$stmt->BindValue(":gfi_created",strtotime($gfi['created']));
|
$stmt->BindValue(":gfi_created",strtotime($gfi['created']));
|
||||||
|
|
||||||
stringPrint("GFI");
|
stringPrint("GFI");
|
||||||
|
|
||||||
// ------------------------------------------------ //
|
// ------------------------------------------------ //
|
||||||
|
|
||||||
// Spotlight
|
// Spotlight
|
||||||
@@ -1067,25 +975,30 @@ function parseItem($data, $item) {
|
|||||||
// Write to DB
|
// Write to DB
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
stringPrint("DB");
|
stringPrint("->DB");
|
||||||
|
|
||||||
// Set fileatime back to original value
|
// Set fileatime back to original value
|
||||||
|
|
||||||
if ($type != "link" && is_writable($pathname) && $p['fixatimes']) {
|
//if ($type != "link" && is_writable($pathname) && $p['fixatimes']) {
|
||||||
@exec("touch -at `date -r ".$atime." +%Y%m%d%H%M.%S` ".$shellpath." 2>&1");
|
// exec("touch -at `date -r ".$atime." +%Y%m%d%H%M.%S` ".$shellpath." 2>&1");
|
||||||
stringPrint("touch");
|
// stringPrint("touch");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Double check stat for file against pre-run value
|
// Double check stat for file against pre-run value
|
||||||
|
|
||||||
if ($type != "link" && $p['paranoid']) {
|
if ($type != "link") {
|
||||||
|
|
||||||
$restat = chop(@shell_exec("stat -x ".$shellpath." 2>&1"));
|
$pre_access = $pre_modify = $pre_change = null;
|
||||||
$post_access = null;
|
$post_access = $post_modify = $post_change = null;
|
||||||
$post_modify = null;
|
|
||||||
$post_change = null;
|
|
||||||
|
|
||||||
foreach (explode("\n", $restat) as $line) {
|
foreach (explode("\n", $sty[$j]) as $line) {
|
||||||
|
$check = substr($line, 0, 6);
|
||||||
|
if ($check == "Access") { $pre_access = $line; }
|
||||||
|
if ($check == "Modify") { $pre_modify = $line; }
|
||||||
|
if ($check == "Change") { $pre_change = $line; }
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (explode("\n", chop(shell_exec("stat -x ".$shellpath." 2>&1"))) as $line) {
|
||||||
$check = substr($line, 0, 6);
|
$check = substr($line, 0, 6);
|
||||||
if ($check == "Access") { $post_access = $line; }
|
if ($check == "Access") { $post_access = $line; }
|
||||||
if ($check == "Modify") { $post_modify = $line; }
|
if ($check == "Modify") { $post_modify = $line; }
|
||||||
@@ -1109,6 +1022,7 @@ function parseItem($data, $item) {
|
|||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo ProgressBar::next();
|
echo ProgressBar::next();
|
||||||
|
$j++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/php
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Media filetypes
|
// Filetypes
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
$t_files['ffmpeg'] = array( "mkv",
|
$t_files['ffmpeg'] = array( "mkv",
|
||||||
@@ -21,7 +20,7 @@ $t_files['ffmpeg'] = array( "mkv",
|
|||||||
"flv",
|
"flv",
|
||||||
"webm" );
|
"webm" );
|
||||||
|
|
||||||
$t_files['vips'] = array( "jpg",
|
$t_files['sips'] = array( "jpg",
|
||||||
"jpeg",
|
"jpeg",
|
||||||
"tif",
|
"tif",
|
||||||
"tiff",
|
"tiff",
|
||||||
@@ -126,6 +125,6 @@ $e_files = array( "ai",
|
|||||||
foreach ($e_files as $ext) { $e_files[] = strtoupper($ext); }
|
foreach ($e_files as $ext) { $e_files[] = strtoupper($ext); }
|
||||||
foreach ($m_files as $ext) { $m_files[] = strtoupper($ext); }
|
foreach ($m_files as $ext) { $m_files[] = strtoupper($ext); }
|
||||||
foreach ($t_files['ffmpeg'] as $ext) { $t_files['ffmpeg'][] = strtoupper($ext); }
|
foreach ($t_files['ffmpeg'] as $ext) { $t_files['ffmpeg'][] = strtoupper($ext); }
|
||||||
foreach ($t_files['vips'] as $ext) { $t_files['vips'][] = strtoupper($ext); }
|
foreach ($t_files['sips'] as $ext) { $t_files['sips'][] = strtoupper($ext); }
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,6 +1,41 @@
|
|||||||
#!/usr/bin/php
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// Classes
|
||||||
|
//////////////////////////////////////////
|
||||||
|
|
||||||
|
class ProgressBar {
|
||||||
|
|
||||||
|
protected static $done = 0;
|
||||||
|
protected static $total = 0;
|
||||||
|
|
||||||
|
public static function display($message = null) {
|
||||||
|
$string = "PROGRESS:".round((self::$done/self::$total)*100,2);
|
||||||
|
if ($message) {
|
||||||
|
return "\t".$string."\n".$message;
|
||||||
|
} elseif (!strpos(__FILE__,".app")) {
|
||||||
|
return "\r\033[K\r".$string;
|
||||||
|
} else {
|
||||||
|
return "\n".$string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function start($total, $message = null) {
|
||||||
|
self::$total = $total;
|
||||||
|
return $message."\n".self::display();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function next($message = null) {
|
||||||
|
self::$done++;
|
||||||
|
return self::display($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function finish() {
|
||||||
|
self::$done = 0;
|
||||||
|
return "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
|
|
||||||
@@ -19,11 +54,7 @@ function stringPrint($string) {
|
|||||||
echo $string.@str_repeat(" ", (10-strlen($string)));
|
echo $string.@str_repeat(" ", (10-strlen($string)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function bashcolor($string, $color) {
|
function shortlabel($pathname, $max = 99, $pad = false) {
|
||||||
echo $string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function shortlabel($pathname, $max, $min = null) {
|
|
||||||
$basename = basename($pathname);
|
$basename = basename($pathname);
|
||||||
$suffix = "(...).".pathinfo($basename,PATHINFO_EXTENSION);
|
$suffix = "(...).".pathinfo($basename,PATHINFO_EXTENSION);
|
||||||
if (strlen($basename) > $max) {
|
if (strlen($basename) > $max) {
|
||||||
@@ -31,12 +62,10 @@ function shortlabel($pathname, $max, $min = null) {
|
|||||||
} else {
|
} else {
|
||||||
$return = $basename;
|
$return = $basename;
|
||||||
}
|
}
|
||||||
if (strlen($return) < $min) {
|
if ($pad) {
|
||||||
$out = $return.@str_repeat(" ", ($min-strlen($return)));
|
$return = $return.@str_repeat(" ", ($max-strlen($return)));
|
||||||
} else {
|
|
||||||
$out = $return;
|
|
||||||
}
|
}
|
||||||
return $out;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function human_filesize($bytes, $decimals = 2) {
|
function human_filesize($bytes, $decimals = 2) {
|
||||||
|
|||||||
59
web/rtc.php
59
web/rtc.php
@@ -1,26 +1,71 @@
|
|||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
div.container { display: flex; flex-flow: row wrap; justify-content: center; }
|
||||||
|
div.flexfill { width: 220px; height: 1px; }
|
||||||
|
div.item { width: 190px; height: 220px; padding: 20px; }
|
||||||
|
img { width: 128px; height: 128px; }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
|
||||||
|
function findicon($filename) {
|
||||||
|
$ext = pathinfo($filename)['extension'];
|
||||||
|
if (!$ext) {
|
||||||
|
$good = "icons/directory.png";
|
||||||
|
} else {
|
||||||
|
$good = "icons/null.png";
|
||||||
|
}
|
||||||
|
foreach (glob("icons/*.png") as $file) {
|
||||||
|
if (pathinfo($file)['filename'] == $ext) {
|
||||||
|
$good = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $good;
|
||||||
|
}
|
||||||
|
|
||||||
$db_file = $_GET['db'];
|
$db_file = $_GET['db'];
|
||||||
|
|
||||||
if ($db_file) {
|
if ($db_file) {
|
||||||
|
|
||||||
|
echo "<div class='container'>";
|
||||||
|
|
||||||
|
if (!is_readable($db_file)) { echo "can't read db file"; die; }
|
||||||
|
|
||||||
echo "<a href='?db='><-</a>";
|
echo "<a href='?db='><-</a>";
|
||||||
|
|
||||||
$dbo = new PDO("sqlite:".$db_file);
|
$dbo = new PDO("sqlite:".$db_file);
|
||||||
//$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
$dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$array = $dbo->query("SELECT children FROM family WHERE rowid = 1)")->fetch();
|
$array = $dbo->query("SELECT children FROM family WHERE (rowid=2)")->fetch()['children'];
|
||||||
|
|
||||||
print_r(unserialize($array));
|
$array = unserialize($array);
|
||||||
|
|
||||||
die;
|
//echo "<pre>"; print_r($array); echo "</pre>";
|
||||||
|
|
||||||
|
foreach ($array as $key => $item) {
|
||||||
|
|
||||||
|
$row = $dbo->query("SELECT * FROM files WHERE (pid='".$item."')")->fetchAll()[0];
|
||||||
|
//echo "<pre>"; print_r($row); echo "</pre>";
|
||||||
|
|
||||||
|
$icon = "<img src='".findicon($row['Filename'])."'>";
|
||||||
|
|
||||||
|
echo "<div class='item'>".$icon."<br>".$row['Filename']."</div>";
|
||||||
|
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (glob("skim/*.bundle") as $skim) {
|
echo "</div>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
foreach (glob("skim/*.bundle") as $skim) {
|
||||||
$dbs = glob($skim."/*.sqlite3");
|
$dbs = glob($skim."/*.sqlite3");
|
||||||
foreach ($dbs as $db) {
|
foreach ($dbs as $db) {
|
||||||
if (!strpos($db,"pool")) {
|
if (!strpos($db,"pool")) {
|
||||||
@@ -28,6 +73,10 @@ foreach (glob("skim/*.bundle") as $skim) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "<hr><br>".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
$browser_version = "0.4.5";
|
$browser_version = "0.4.5";
|
||||||
|
|
||||||
require_once("togggle.php");
|
|
||||||
date_default_timezone_set("America/Los_Angeles");
|
date_default_timezone_set("America/Los_Angeles");
|
||||||
|
|
||||||
$method = "id";
|
$method = "id";
|
||||||
|
|||||||
Reference in New Issue
Block a user