From 489ff7cd7019bc72a068bdba5e0450761d33730d Mon Sep 17 00:00:00 2001 From: profiteroles Date: Mon, 3 Sep 2018 02:53:01 -0700 Subject: [PATCH] 0.7.3 --- Yuba.php | 80 ++++++++++++++++++++++++++++++++-------------- functions.php | 7 ---- web/rtc.php | 88 +++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 129 insertions(+), 46 deletions(-) mode change 100755 => 100644 Yuba.php mode change 100755 => 100644 functions.php diff --git a/Yuba.php b/Yuba.php old mode 100755 new mode 100644 index efc5eb4..7ed32e0 --- a/Yuba.php +++ b/Yuba.php @@ -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 diff --git a/functions.php b/functions.php old mode 100755 new mode 100644 index 6e3c1ac..b51a95f --- a/functions.php +++ b/functions.php @@ -50,10 +50,6 @@ function getParents($zpath, $pathname) { } */ -function stringPrint($string) { - echo $string.@str_repeat(" ", (10-strlen($string))); - } - function shortlabel($pathname, $max = 99, $pad = false) { $basename = basename($pathname); $suffix = "(...).".pathinfo($basename,PATHINFO_EXTENSION); @@ -62,9 +58,6 @@ function shortlabel($pathname, $max = 99, $pad = false) { } else { $return = $basename; } - if ($pad) { - $return = $return.@str_repeat(" ", ($max-strlen($return))); - } return $return; } diff --git a/web/rtc.php b/web/rtc.php index 6624929..c3c346e 100644 --- a/web/rtc.php +++ b/web/rtc.php @@ -1,11 +1,24 @@ + + @@ -14,12 +27,20 @@ img { width: 64px; height: 64px; } $max) { + $return = substr($filename, 0, ($max-strlen($suffix))).$suffix; + } else { + $return = $filename; + } + return $return; + } + function findicon($filename) { $ext = pathinfo($filename)['extension']; if (!$ext) { @@ -35,24 +56,29 @@ function findicon($filename) { return $good; } -//////////////////////////////////////////////// +///////////////////////////////////////////////////////////////// $db_file = $_GET['db']; +$pid = $_GET['pid']; if ($db_file) { - // Show a view + // View if (!is_readable($db_file)) { echo "can't read db file"; die; } - echo "index"; + echo "db list"; echo "
"; $dbo = new PDO("sqlite:".$db_file); $dbo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - $array = $dbo->query("SELECT children FROM family WHERE (rowid=2)")->fetch()['children']; + if (!$pid) { + $array = $dbo->query("SELECT children FROM family WHERE (rowid=2)")->fetch()['children']; + } else { + $array = $dbo->query("SELECT children FROM family WHERE (pid='".$pid."')")->fetch()['children']; + } $children = unserialize($array); @@ -62,26 +88,55 @@ if ($db_file) { echo "
"; echo "\n
"; + dsf + print_r($children); - foreach ($children as $key => $item) { + if (count($children) < 1) { echo "dir is empty."; die; } + + foreach ($children as $item) { + + echo "
"; $row_a = $dbo->query("SELECT * FROM files WHERE (pid='".$item."')")->fetchAll()[0]; //$row_b = $dbo->query("SELECT * FROM mdls WHERE (pid='".$item."')")->fetchAll()[0]; //$row_c = $dbo->query("SELECT * FROM milk WHERE (pid='".$item."')")->fetchAll()[0]; - $icon = ""; + if ($row_a['thumb_filename']) { + $aspect = $row_a['thumb_width']/$row_a['thumb_height']; + if ($aspect > 1) { + $width = $icon_size; + $height = $icon_size/$aspect; + } else { + $width = $icon_size*$aspect; + $height = $icon_size; + } + $realfile = dirname($db_file).$row_a['thumb_filename']; + $icon = ""; + } else { + $icon = ""; + } - echo "\n
".$icon."
".htmlentities($row_a['Filename'])."
"; - + $name = htmlentities(shortlabel($row_a['Filename'])); + + if ($row_a['Type'] == "dir") { + echo "\n".$icon."
".$name; + } else { + echo $icon."
".$name; + } + + echo "
"; echo "
"; } - + + echo str_repeat("
", 100); echo "\n
"; } else { - + +///////////////////////////////////////////////////////////////// + // DB List $bundles = glob("skim/*.bundle"); @@ -101,6 +156,7 @@ if ($db_file) { } } +///////////////////////////////////////////////////////////////// echo "

".round($time = microtime(true)-$_SERVER["REQUEST_TIME_FLOAT"],2)." seconds";