This commit is contained in:
2018-09-03 02:53:01 -07:00
parent d2ed189d2b
commit 489ff7cd70
3 changed files with 129 additions and 46 deletions

80
Yuba.php Executable file → Normal file
View File

@@ -3,7 +3,7 @@
// Yuba
// //
//////////////////////////////////////////
$version = "0.7.2.5";
$version = "0.7.3";
ini_set('memory_limit', '4096M');
date_default_timezone_set("America/Los_Angeles");
@@ -228,30 +228,14 @@ $dbo->exec("CREATE TABLE files (
gfi_attr TEXT,
gfi_created TEXT,
Size INTEGER,
Title TEXT,
PixelWidth INTEGER,
PixelHeight INTEGER,
Duration INTEGER,
DateTimeOriginal INTEGER,
Origin TEXT,
GPS TEXT,
Author TEXT,
has_exif INTEGER,
has_mediainfo INTEGER,
has_hash INTEGER,
thumb_filename TEXT,
thumb_width INTEGER,
thumb_height INTEGER,
ProfileDescription TEXT,
BitDepth INTEGER,
Compression TEXT,
Orientation INTEGER,
LensType TEXT,
VideoFormat TEXT,
AudioFormat TEXT,
Tracks INTEGER,
Profile TEXT,
Bitrate INTEGER
has_contents INTEGER,
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, :stats, :qlmanage, :sysvers, :diskutil, :disks, :df, :df_device, :df_volume, :mdutil, :profile, :status)");
@@ -328,6 +312,8 @@ $files = new RecursiveIteratorIterator(
// Tally
//////////////////////////////////////////
echo "Tally\n";
foreach ($files as $null) { }
$first_run = 0;
@@ -391,7 +377,6 @@ $dbp->exec("CREATE TABLE IF NOT EXISTS contents (fid TEXT, created INTEGER, rela
//////////////////////////////////////////
$family = array();
$fids = array();
echo ProgressBar::start($passed_total,"Prescan");
@@ -615,7 +600,8 @@ if ($p['meta']) {
if (!$check) {
$stmt = $dbp->prepare("INSERT INTO mediainfo VALUES (:fid, :info)");
$stmt->BindValue(":fid",$fid);
$stmt->BindValue(":info",serialize(parseMediaInfo(shell_exec($bin_mediainfo." --Output=OLDXML ".$shellpath." 2>&1"))));
//$stmt->BindValue(":info",serialize(parseMediaInfo(shell_exec($bin_mediainfo." --Output=OLDXML ".$shellpath." 2>&1"))));
$stmt->BindValue(":info",shell_exec($bin_mediainfo." --Output=OLDXML ".$shellpath." 2>&1"));
$stmt->execute();
}
}
@@ -754,6 +740,54 @@ if ($p['spotlight']) {
}
// Milk
//////////////////////////////////////////
// Aggregate values
$sb['a'] = array( "t*Title" => array("e_Title","k_Title","m_Title"),
"t*Dimensions" => array("k_PixelWidth.k_PixelHeight","e_PixelWidth.e_PixelHeight","m_PixelWidth.m_PixelHeight"),
"i*Seconds" => array("k_DurationSeconds","e_Duration","m_Duration"),
"d*DateTime" => array("e_DateTimeOriginal","m_EncodedDate","e_CreateDate","e_MediaCreateDate","k_ContentCreationDate"),
"t*Origin" => array("e_CameraModelName","e_Producer","e_CreatorTool","e_WriterName","e_Software","e_Encoder","m_WritingApplication"),
"t*GPS" => array("e_GPSPosition","k_Latitude.k_Longitude"),
"t*Author" => array("e_Author","e_Artist","e_Creator","e_By-line")
);
// Exiftool values
$sb['e'] = array( "i*Orientation",
"t*Compression",
"t*ProfileDescription",
"i*BitDepth",
"t*LensType",
"t*FocalLength",
"t*Aperture",
"t*LightSource",
"t*WhiteBalance" );
// Mediainfo values
$sb['m'] = array( "t*VideoFormat",
"t*AudioFormat",
"i*Tracks",
"t*Profile",
"t*Bitrate" );
// Build DB
unset($cbuild, $ibuild);
foreach (array_merge(array_keys($sb['a']),$sb['e'],$sb['m']) as $name) {
$parts = explode("*",$name);
$ibuild[] = ":".$parts[1];
if ($parts[0] == "t") {
$cbuild[] = $parts[1]." TEXT";
} else {
$cbuild[] = $parts[1]." INTEGER";
}
}
$dbo->exec("CREATE TABLE milk (".implode(",",$cbuild).")");
$stmt = $dbo->prepare("INSERT INTO milk VALUES (".implode(",",$ibuild).")");
$stmt->execute();
// Files
//////////////////////////////////////////
@@ -767,7 +801,7 @@ foreach ($files as $splFileInfo) {
// DB
$stmt = $dbo->prepare("INSERT INTO files VALUES (:pid, :fid, :Pathname, :Path, :Filename, :Extension, :Type, :Inode, :Perms, :Owner, :ATime, :CTime, :MTime, :LinkTarget, :RealPath, :stat, :items, :newest, :gfi_type, :gfi_attr, :gfi_created, :Size, :Title, :PixelWidth, :PixelHeight, :Duration, :DateTimeOriginal, :Origin, :GPS, :Author, :has_exif, :has_mediainfo, :has_hash, :thumb_filename, :thumb_width, :thumb_height, :ProfileDescription, :BitDepth, :Compression, :Orientation, :LensType, :VideoFormat, :AudioFormat, :Tracks, :Profile, :Bitrate)");
$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)");
// Identify dir, file, link or bundle dir
@@ -913,7 +947,7 @@ foreach ($files as $splFileInfo) {
// ------------------------------------------------ //
// Breakouts
// Milk