This commit is contained in:
2020-01-27 03:32:56 -08:00
parent 743ee4be1f
commit fbe2b8a7e8
10 changed files with 58 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
// Functions
function makeWindowString($p, $strings) {
function makeWindowString($p, $strings, $pstrings) {
$conf = "
# Set window title
@@ -42,16 +42,23 @@ function makeWindowString($p, $strings) {
hr0.path = ".__DIR__."/hr.png"."
hr0.width = 380
hr0.height = 2
parallel.type = popup
parallel.width = 180
parallel.default = ".$pstrings[$p['parallel']]."
";
foreach ($pstrings as $pstring) {
$conf .= "parallel.option = ".$pstring."\n";
}
parallel.type = checkbox
parallel.label = Use parallel
parallel.default = ".$p['parallel']."
$conf .= "
debug.type = checkbox
debug.label = Verbose logging
debug.default = ".$p['debug']."
debug.x = 200
debug.y = 439
debug.y = 443
hr1.type = image
hr1.path = ".__DIR__."/hr.png"."
@@ -216,10 +223,19 @@ $strings[] = array("Skip","Generate","Rebuild");
$strings[] = array("Most files","Some files");
$strings[] = array("All files","Most files","Some files");
// Parallel strings
$physicalcpu = trim(shell_exec("sysctl -n hw.physicalcpu"));
$pstrings = array("Sequential","Max (Not advised)");
foreach(range(2, $physicalcpu-1) as $index) {
$pstrings[] = $index." Cores";
}
// Launch Pashua and parse results
$path = __DIR__."/bin/Pashua.app/Contents/MacOS/Pashua";
$raw = shell_exec("echo ".escapeshellarg(makeWindowString($p, $strings))." | ".escapeshellarg($path)." - ");
$raw = shell_exec("echo ".escapeshellarg(makeWindowString($p, $strings, $pstrings))." | ".escapeshellarg($path)." - ");
$result = array();
foreach (explode("\n", $raw) as $line) {
preg_match('/^(\w+)=(.*)$/', $line, $matches);
@@ -244,6 +260,7 @@ $result['thumbs'] = array_search($result['thumbs'],$strings[2]);
$result['thumb_mode'] = array_search($result['thumb_mode'],$strings[3]);
$result['icons'] = array_search($result['icons'],$strings[2]);
$result['icon_mode'] = array_search($result['icon_mode'],$strings[4]);
$result['parallel'] = array_search($result['parallel'],$pstrings);
// If the user didn't specify a destpath, set to default