0.7.12.8
68
Tester/IconTester.platypus
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AcceptsFiles</key>
|
||||
<true/>
|
||||
<key>AcceptsText</key>
|
||||
<false/>
|
||||
<key>Authentication</key>
|
||||
<false/>
|
||||
<key>Author</key>
|
||||
<string>profiteroles</string>
|
||||
<key>BundledFiles</key>
|
||||
<array>
|
||||
<string>/Volumes/Code/Yuba/bin</string>
|
||||
</array>
|
||||
<key>Creator</key>
|
||||
<string>Platypus-5.3</string>
|
||||
<key>DeclareService</key>
|
||||
<false/>
|
||||
<key>DevelopmentVersion</key>
|
||||
<false/>
|
||||
<key>Droppable</key>
|
||||
<true/>
|
||||
<key>IconPath</key>
|
||||
<string>/Volumes/Code/Yuba/master/Tester/icon.icns</string>
|
||||
<key>Identifier</key>
|
||||
<string>org.profiteroles.IconTester</string>
|
||||
<key>InterfaceType</key>
|
||||
<string>Text Window</string>
|
||||
<key>InterpreterPath</key>
|
||||
<string>/usr/bin/php</string>
|
||||
<key>Name</key>
|
||||
<string>IconTester</string>
|
||||
<key>NibPath</key>
|
||||
<string>/usr/local/share/platypus/MainMenu.nib</string>
|
||||
<key>OptimizeApplication</key>
|
||||
<true/>
|
||||
<key>Overwrite</key>
|
||||
<false/>
|
||||
<key>PromptForFileOnLaunch</key>
|
||||
<false/>
|
||||
<key>RemainRunning</key>
|
||||
<true/>
|
||||
<key>RunInBackground</key>
|
||||
<false/>
|
||||
<key>ScriptArgs</key>
|
||||
<array>
|
||||
<string>icon</string>
|
||||
</array>
|
||||
<key>ScriptPath</key>
|
||||
<string>/Volumes/Code/Yuba/master/Tester/Tester.php</string>
|
||||
<key>TextBackground</key>
|
||||
<string>#ffffff</string>
|
||||
<key>TextFont</key>
|
||||
<string>Monaco</string>
|
||||
<key>TextForeground</key>
|
||||
<string>#000000</string>
|
||||
<key>TextSize</key>
|
||||
<real>13</real>
|
||||
<key>UniformTypes</key>
|
||||
<array>
|
||||
<string>public.item</string>
|
||||
</array>
|
||||
<key>Version</key>
|
||||
<string>0.0.0.1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
118
Tester/Tester.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?
|
||||
|
||||
// Yuba Preview Tester 0.1.5
|
||||
|
||||
//print_r($argv);
|
||||
|
||||
$mode = $argv[1];
|
||||
|
||||
// Bundled tools
|
||||
$bin_gfi = __DIR__."/bin/GetFileInfo";
|
||||
$bin_mediainfo = __DIR__."/bin/mediainfo";
|
||||
$bin_exiftool = __DIR__."/bin/exiftool";
|
||||
$bin_ffmpeg = __DIR__."/bin/ffmpeg";
|
||||
$bin_qlthumb = __DIR__."/bin/ql-thumbnail";
|
||||
$bin_qlicon = __DIR__."/bin/ql-icon";
|
||||
$bin_qltool = __DIR__."/bin/qltool";
|
||||
$bin_sox = __DIR__."/bin/sox";
|
||||
$bin_pngquant = __DIR__."/bin/pngquant";
|
||||
$bin_parallel = __DIR__."/bin/parallel";
|
||||
|
||||
// System tools
|
||||
$bin_php = "php";
|
||||
$bin_qlmanage = "qlmanage";
|
||||
$bin_sips = "sips";
|
||||
|
||||
// External tools
|
||||
$bin_convert = "/opt/local/bin/convert";
|
||||
$bin_vips = "/opt/local/bin/vipsthumbnail";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (empty(shell_exec("which ".$bin_convert))) { echo "Binary not found: ".$bin_convert."\n"; }
|
||||
if (empty(shell_exec("which ".$bin_vips))) { echo "Binary not found: ".$bin_vips."\n"; }
|
||||
|
||||
if (empty($argv[2])) { echo "Nothing dragged"; die; }
|
||||
|
||||
$p['icon_size'] = 512;
|
||||
$p['thumb_size'] = 1024;
|
||||
|
||||
$shellpath = escapeshellarg($argv[2]);
|
||||
$tprefix = "/tmp/".md5($shellpath.time())."/";
|
||||
$wprefix = "/tmp/".md5($shellpath.time())."_work/";
|
||||
mkdir($tprefix);
|
||||
mkdir($wprefix);
|
||||
|
||||
if ($mode == "thumb") {
|
||||
|
||||
$cmd['sips'][] = $bin_sips." -s format jpeg -s formatOptions 80 -Z ".$p['thumb_size']." ".$shellpath." --out ".$tprefix."sips.jpg"; // add ?? "-d profile --deleteColorManagementProperties"
|
||||
$cmd['sips'][] = $tprefix."sips.jpg";
|
||||
|
||||
$cmd['convert'][] = $bin_convert." -density 300 ".$shellpath."[0] -scale ".$p['thumb_size']."x".$p['thumb_size']." -quality 95 ".$tprefix."convert.jpg";;
|
||||
$cmd['convert'][] = $tprefix."convert.jpg";
|
||||
|
||||
$cmd['vips'][] = $bin_vips." ".$shellpath." -o ".$tprefix."vips.jpg[Q=90,optimize_coding] --size=".$p['thumb_size'];
|
||||
$cmd['vips'][] = $tprefix."vips.jpg";
|
||||
|
||||
$cmd['qltool'][] = $bin_qltool." dp ".$shellpath." ".$p['thumb_size']." ".$p['thumb_size']." | base64 --decode | ".$bin_convert." - -scale 50% -strip -define png:compression-level=9 ".$tprefix."qltool.png";
|
||||
$cmd['qltool'][] = $tprefix."qltool.png";
|
||||
|
||||
$cmd['qlmanage'][] = $bin_qlmanage." -t -s ".$p['thumb_size']." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage.png";
|
||||
$cmd['qlmanage'][] = $tprefix."qlmanage.png";
|
||||
|
||||
$cmd['ql-thumbnail'][] = $bin_qlthumb." ".$shellpath." ".$tprefix."qlthumb.jpg public.jpeg ".$p['thumb_size']." ".$p['thumb_size']." .8";
|
||||
$cmd['ql-thumbnail'][] = $tprefix."qlthumb.jpg";
|
||||
|
||||
$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 +dither -colors 16 ".$tprefix."sox.png";
|
||||
//$cmd['sox'][] = $bin_sox." ".$shellpath." -n trim 0 $(".$bin_exiftool." -s -s -s -duration# ".$shellpath." | awk '{print $1/10}') spectrogram -o ".$tpfile."; ".$bin_sips." -s format jpeg -s formatOptions 80 ".escapeshellarg($tpfile)." --out ".$tprefix."sox.png";
|
||||
$cmd['sox'][] = $tprefix."sox.png";
|
||||
|
||||
$cmd['ffmpeg'][] = $bin_ffmpeg." -ss $(( $(".$bin_mediainfo." --Inform='Video;%Duration%' ".$shellpath." | cut -d'.' -f1) / 10000 )) -i ".$shellpath." -vframes 1 -filter:v scale='".$p['thumb_size'].":-2' -q:v 3 ".$tprefix."ffmpeg.jpg"; // only works properly on horizontal videos
|
||||
$cmd['ffmpeg'][] = $tprefix."ffmpeg.jpg";
|
||||
|
||||
} elseif ($mode == "icon") {
|
||||
|
||||
$cmd['qltool'][] = $bin_qltool." di ".$shellpath." ".$p['icon_size']." ".$p['icon_size']." | base64 --decode | ".$bin_convert." - -scale 50% -strip -define png:compression-level=9 ".$tprefix."qltool.png";
|
||||
$cmd['qltool'][] = $tprefix."qltool.png";
|
||||
|
||||
$cmd['ql-icon'][] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." --output=".$tprefix."qlicon.png";
|
||||
$cmd['ql-icon'][] = $tprefix."qlicon.png";
|
||||
|
||||
$cmd['ql-icon_q'][] = $bin_qlicon." --input=".$shellpath." --width=".$p['icon_size']." --height=".$p['icon_size']." | ".$bin_pngquant." - > ".$tprefix."qlicon-quant.png";
|
||||
$cmd['ql-icon_q'][] = $tprefix."qlicon-quant.png";
|
||||
|
||||
$cmd['qlmanage_sx'][] = $bin_qlmanage." -ti -s ".$p['icon_size']." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage-size.png";
|
||||
$cmd['qlmanage_sx'][] = $tprefix."qlmanage-size.png";
|
||||
|
||||
$cmd['qlmanage_fx'][] = $bin_qlmanage." -ti -f ".floor($p['icon_size']/128)." -o ".$wprefix." ".$shellpath." ; mv ".escapeshellarg($wprefix.basename($argv[2]).".png")." ".$tprefix."qlmanage-multiplier.png";
|
||||
$cmd['qlmanage_fx'][] = $tprefix."qlmanage-multiplier.png";
|
||||
|
||||
$cmd['qlmanage_zx'][] = $bin_qlmanage." -ti -F ".floor($p['icon_size']/64)." -o ".$wprefix." ".$shellpath." ; sips -z ".$p['icon_size']." ".$p['icon_size']." ".escapeshellarg($wprefix.basename($argv[2]).".png")." --out ".$tprefix."qlmanage-multiplier_large.png";
|
||||
$cmd['qlmanage_zx'][] = $tprefix."qlmanage-multiplier_large.png";
|
||||
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
foreach ($cmd as $exec) {
|
||||
|
||||
$start = microtime(true);
|
||||
echo $exec[0]."\n";
|
||||
shell_exec($exec[0]);
|
||||
$elapsed = substr((microtime(true)-$start),2,3);
|
||||
|
||||
$ext = pathinfo($exec[1], PATHINFO_EXTENSION);
|
||||
$file = pathinfo($exec[1], PATHINFO_FILENAME);
|
||||
$dir = pathinfo($exec[1], PATHINFO_DIRNAME);
|
||||
|
||||
if(!filesize($exec[1])) {
|
||||
echo "NO RESULT\n";
|
||||
} else {
|
||||
rename($exec[1],$dir."/".$i."_".$file."_".$elapsed."msec.".$ext);
|
||||
}
|
||||
echo "\n \n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
shell_exec("qlmanage -p ".$tprefix."/* > /dev/null 2>&1");
|
||||
|
||||
?>
|
||||
68
Tester/ThumbTester.platypus
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AcceptsFiles</key>
|
||||
<true/>
|
||||
<key>AcceptsText</key>
|
||||
<false/>
|
||||
<key>Authentication</key>
|
||||
<false/>
|
||||
<key>Author</key>
|
||||
<string>profiteroles</string>
|
||||
<key>BundledFiles</key>
|
||||
<array>
|
||||
<string>/Volumes/Code/Yuba/bin</string>
|
||||
</array>
|
||||
<key>Creator</key>
|
||||
<string>Platypus-5.3</string>
|
||||
<key>DeclareService</key>
|
||||
<false/>
|
||||
<key>DevelopmentVersion</key>
|
||||
<false/>
|
||||
<key>Droppable</key>
|
||||
<true/>
|
||||
<key>IconPath</key>
|
||||
<string>/Volumes/Code/Yuba/master/Tester/icon.icns</string>
|
||||
<key>Identifier</key>
|
||||
<string>org.profiteroles.ThumbTester</string>
|
||||
<key>InterfaceType</key>
|
||||
<string>Text Window</string>
|
||||
<key>InterpreterPath</key>
|
||||
<string>/usr/bin/php</string>
|
||||
<key>Name</key>
|
||||
<string>ThumbTester</string>
|
||||
<key>NibPath</key>
|
||||
<string>/usr/local/share/platypus/MainMenu.nib</string>
|
||||
<key>OptimizeApplication</key>
|
||||
<true/>
|
||||
<key>Overwrite</key>
|
||||
<false/>
|
||||
<key>PromptForFileOnLaunch</key>
|
||||
<false/>
|
||||
<key>RemainRunning</key>
|
||||
<true/>
|
||||
<key>RunInBackground</key>
|
||||
<false/>
|
||||
<key>ScriptArgs</key>
|
||||
<array>
|
||||
<string>thumb</string>
|
||||
</array>
|
||||
<key>ScriptPath</key>
|
||||
<string>/Volumes/Code/Yuba/master/Tester/Tester.php</string>
|
||||
<key>TextBackground</key>
|
||||
<string>#ffffff</string>
|
||||
<key>TextFont</key>
|
||||
<string>Monaco</string>
|
||||
<key>TextForeground</key>
|
||||
<string>#000000</string>
|
||||
<key>TextSize</key>
|
||||
<real>13</real>
|
||||
<key>UniformTypes</key>
|
||||
<array>
|
||||
<string>public.item</string>
|
||||
</array>
|
||||
<key>Version</key>
|
||||
<string>0.0.0.1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Tester/icon.icns
Normal file
BIN
Tester/icon.iconset/icon_128x128.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
Tester/icon.iconset/icon_128x128@2x.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
Tester/icon.iconset/icon_16x16.png
Normal file
|
After Width: | Height: | Size: 823 B |
BIN
Tester/icon.iconset/icon_16x16@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Tester/icon.iconset/icon_256x256.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
Tester/icon.iconset/icon_256x256@2x.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
Tester/icon.iconset/icon_32x32.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
Tester/icon.iconset/icon_32x32@2x.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
Tester/icon.iconset/icon_512x512.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
Tester/icon.iconset/icon_512x512@2x.png
Normal file
|
After Width: | Height: | Size: 155 KiB |