0.7.12.5
This commit is contained in:
38
Yuba.php
38
Yuba.php
@@ -84,6 +84,7 @@ $bin_ffmpeg = __DIR__."/bin/ffmpeg";
|
||||
$bin_qlthumb = __DIR__."/bin/ql-thumbnail";
|
||||
$bin_qltool = __DIR__."/bin/qltool";
|
||||
$bin_magick = __DIR__."/bin/magick";
|
||||
$bin_sox = __DIR__."/bin/sox";
|
||||
$bin_pngcrush = __DIR__."/bin/pngcrush";
|
||||
$bin_vips = "vipsthumbnail";
|
||||
|
||||
@@ -535,6 +536,19 @@ $dbo->exec($stmt);
|
||||
|
||||
$wopt_currstep++;
|
||||
|
||||
// Directory Previews
|
||||
//////////////////////////////////////////
|
||||
|
||||
echo ProgressBar::start(count($fx),"Searching for directory previews (".stepString().")");
|
||||
|
||||
foreach ($fx as $array) {
|
||||
$fid = $array[0];
|
||||
$pathname = $array[1];
|
||||
if (in_array(basename($pathname),$p['p_files'])) {
|
||||
$dpreview[dirname($pathname)] = $fid;
|
||||
}
|
||||
}
|
||||
|
||||
// Thumbnails
|
||||
//////////////////////////////////////////
|
||||
|
||||
@@ -566,7 +580,7 @@ if ($p['thumbs']) {
|
||||
echo ProgressBar::next("Thumb file found for ".shortlabel($pathname));
|
||||
continue;
|
||||
} elseif ($dbp->query("SELECT EXISTS(SELECT 1 FROM thumbs WHERE fid='".$fid."')")->fetch()[0]) {
|
||||
// if no thumb file, then poll database
|
||||
// if no thumb file, then poll database for prior attempt
|
||||
echo ProgressBar::next("Thumb record found for ".shortlabel($pathname));
|
||||
continue;
|
||||
} else {
|
||||
@@ -586,16 +600,19 @@ if ($p['thumbs']) {
|
||||
$tmp_path = escapeshellarg("/tmp/".basename($pathname).".png"); // qlmanage workaround
|
||||
|
||||
$fmt['sips'] = $tfile;
|
||||
$fmt['sox'] = $tpfile;
|
||||
$fmt['ffmpeg'] = $tfile;
|
||||
$fmt['ql-thumbnail'] = $tfile;
|
||||
$fmt['qltool'] = $tpfile;
|
||||
$fmt['qlmanage'] = $tpfile;
|
||||
$fmt['vips'] = $tfile;
|
||||
|
||||
$cmd['sox'] = $bin_sox." ".$shellpath." -n trim 00:10 00:30 spectrogram -o - | ".$bin_magick." 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 - -resize 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 -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;
|
||||
// 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;
|
||||
@@ -605,6 +622,8 @@ if ($p['thumbs']) {
|
||||
$external_tool = "sips";
|
||||
} elseif (in_array($ext, $p['t_files']['ffmpeg'])) {
|
||||
$external_tool = "ffmpeg";
|
||||
} elseif (in_array($ext, $p['t_files']['sox'])) {
|
||||
$external_tool = "sox";
|
||||
} else {
|
||||
$external_tool = null;
|
||||
}
|
||||
@@ -1069,7 +1088,22 @@ foreach ($files as $splFileInfo) {
|
||||
$stmt->BindValue(":thumb_filename",null);
|
||||
}
|
||||
|
||||
} elseif ($type == "dir") {
|
||||
|
||||
if (is_array($dpreview) && $dpreview[$pathname]) {
|
||||
$fetch_thumb = $dbp->query("SELECT * FROM thumbs WHERE fid='".$dpreview[$pathname]."'")->fetch();
|
||||
if (@$fetch_thumb['relative_path']) {
|
||||
$stmt->BindValue(":thumb_filename",$fetch_thumb['relative_path']);
|
||||
$stmt->BindValue(":thumb_width",$fetch_thumb['width']);
|
||||
$stmt->BindValue(":thumb_height",$fetch_thumb['height']);
|
||||
$stmt->BindValue(":thumb_tool",$fetch_thumb['tool']);
|
||||
} else {
|
||||
$stmt->BindValue(":thumb_filename",null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------ //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user