From 570d76d78c180366478dca6574bc35b6459ac2c0 Mon Sep 17 00:00:00 2001 From: profiteroles Date: Thu, 13 Jun 2019 23:18:02 -0700 Subject: [PATCH] Icons, fixes --- Yuba.php | 81 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/Yuba.php b/Yuba.php index 04850bf..fca538f 100755 --- a/Yuba.php +++ b/Yuba.php @@ -560,39 +560,6 @@ foreach ($fx as $array) { } echo ProgressBar::finish($wopt_clear); -// Icons Test -////////////////////////////////////////// - -$p['icons'] = 1; - -if ($p['icons']) { - - echo ProgressBar::start($passed_file,"Creating icon batch (".stepString().")",1); - - if (!is_dir("/tmp/Yuba/")) { mkdir("/tmp/Yuba/"); } - if (!is_dir("/tmp/Yuba/".$mytime)) { mkdir("/tmp/Yuba/".$mytime); } - $batchfile = "/tmp/Yuba/".$mytime."/batch.sh"; - $helper = realpath("helper.php"); - - foreach ($fx as $count => $array) { - $fid = $array[0]; - $pathname = $array[1]; - $icmd = $bin_php." ".$helper." icons ".$fid." ".escapeshellarg($pathname)." ".escapeshellarg($bpath)." ".$mytime."; echo ".ProgressBar::next(); - msg($icmd); - $line[] = $icmd; - } - file_put_contents($batchfile,implode("\n", $line)); - - echo ProgressBar::finish($wopt_clear); - - echo ProgressBar::start($passed_file,"Running icon batch (".stepString().")"); - - passthru($bin_parallel." < ".$batchfile); - - echo ProgressBar::finish($wopt_clear); - - } - // Thumbnails ////////////////////////////////////////// @@ -655,15 +622,15 @@ if ($p['thumbs']) { $fmt['qlmanage'] = $tpfile; $fmt['vips'] = $tfile; - $cmd['sox'] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o - | ".$bin_magick." convert - -crop 800x515+58+30 -scale 515x515! +dither -colors 16 ".$tpfile; + $cmd['sox'] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o - | ".$bin_convert." - -crop 800x515+58+30 -scale 515x515! +dither -colors 16 ".$tpfile; $cmd['sips'] = "sips -s format jpeg -s formatOptions 80 --resampleHeightWidthMax ".$p['thumb_size']." ".$shellpath." --out ".$tfile; $cmd['ffmpeg'] = $bin_ffmpeg." -ss $(( $(".$bin_mediainfo." --Inform='Video;%Duration%' ".$shellpath." | cut -d'.' -f1) / 10000 )) -i ".$shellpath." -vframes 1 -filter:v scale='400:-1' -q:v 3 ".$tfile; $cmd['ql-thumbnail'] = $bin_qlthumb." ".$shellpath." ".$tfile." public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8"; - //$cmd['qltool'] = $bin_qltool." di ".$shellpath." ".$p['thumb_size']." ".$p['thumb_size']." | base64 --decode | ".$bin_magick." convert - -scale 50% -strip -trim +repage -define png:compression-level=9 ".$tpfile; - $cmd['qltool'] = $bin_qltool." di ".$shellpath." ".$p['thumb_size']." ".$p['thumb_size']." | base64 --decode | ".$bin_magick." convert - -scale 50% -strip -define png:compression-level=9 ".$tpfile; + //$cmd['qltool'] = $bin_qltool." di ".$shellpath." ".$p['thumb_size']." ".$p['thumb_size']." | base64 --decode | ".$bin_convert." - -scale 50% -strip -trim +repage -define png:compression-level=9 ".$tpfile; + $cmd['qltool'] = $bin_qltool." di ".$shellpath." ".$p['thumb_size']." ".$p['thumb_size']." | base64 --decode | ".$bin_convert." - -scale 50% -strip -define png:compression-level=9 ".$tpfile; // qltool thumbs are double size with half the pixels // repage crops thumbs to edge (match sips/ffmpeg thumbs) - $cmd['qlmanage'] = "qlmanage -ti -f ".floor($p['thumb_size']/128)." -o /tmp/ ".$shellpath."; mv ".$tmp_path." ".$tpfile; + $cmd['qlmanage'] = "qlmanage -t -f ".floor($p['thumb_size']/128)." -o /tmp/ ".$shellpath."; mv ".$tmp_path." ".$tpfile; $cmd['vips'] = $bin_vips." ".$shellpath." -o ".$tfile."[Q=90,optimize_coding] --size=".$p['thumb_size']; if (in_array($ext, $p['t_files']['sips'])) { @@ -723,6 +690,39 @@ if ($p['thumbs']) { } +// Icons +////////////////////////////////////////// + +$p['icons'] = 1; + +if ($p['icons']) { + + echo ProgressBar::start($passed_file,"Creating icon batch (".stepString().")",1); + + if (!is_dir("/tmp/Yuba/")) { mkdir("/tmp/Yuba/"); } + if (!is_dir("/tmp/Yuba/".$mytime)) { mkdir("/tmp/Yuba/".$mytime); } + $batchfile = "/tmp/Yuba/".$mytime."/_batch_icons.sh"; + $helper = realpath("helper.php"); + + foreach ($fx as $count => $array) { + $fid = $array[0]; + $pathname = $array[1]; + $icmd = $bin_php." ".$helper." icons ".$fid." ".escapeshellarg($pathname)." ".escapeshellarg($bpath)." ".$mytime."; echo ".ProgressBar::next(); + msg($icmd); + $line[] = $icmd; + } + file_put_contents($batchfile,implode("\n", $line)); + + echo ProgressBar::finish($wopt_clear); + + echo ProgressBar::start($passed_file,"Running icon batch (".stepString().")"); + + passthru($bin_parallel." < ".$batchfile); + + echo ProgressBar::finish($wopt_clear); + + } + // External metadata ////////////////////////////////////////// @@ -923,8 +923,6 @@ foreach (array_merge($mb['t'],$mb['a']) as $item) { $ibuild[] = ":".$item; } -$p['spotlight'] = 1; - if ($p['spotlight']) { echo ProgressBar::start($passed_total,"Spotlight (".stepString().")"); @@ -1263,7 +1261,10 @@ while ($row_a = $loop->fetch()) { $stmt = $dbo->prepare("INSERT INTO milk VALUES (".implode(",",$ibuild).")"); - $row_b = @$dbo->query("SELECT * FROM mdls WHERE (rowid='".$row_a['rowid']."')")->fetch(); + if ($dbo->query("SELECT name FROM sqlite_master WHERE name='mdls'")->fetch()) { + $row_b = @$dbo->query("SELECT * FROM mdls WHERE (rowid='".$row_a['rowid']."')")->fetch(); + } + if (count(@$row_b) > 1) { $m['k'] = $row_b;