Icons, fixes

This commit is contained in:
2019-06-13 23:18:02 -07:00
parent c6b0caaaa0
commit 570d76d78c

View File

@@ -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;