make_job("{$dir}/{$file}", $batchid, $appid, $calibration); } closedir($d); } function usage() { exit("Usage: php bossa_example_make_jobs.php --app_name x --dir d [--calibration]]\n"); } $calibration = false; for ($i = 1; $i < $argc; $i++) { if ($argv[$i] == '--app_name') { $app_name = $argv[++$i]; } elseif ($argv[$i] == '--dir') { $dir = $argv[++$i]; } elseif ($argv[$i] == '--calibration') { $calibration = true; } else { usage(); } } if (!$app_name || !$dir) { usage(); } $appid = bossa_app_lookup($app_name); if (!$appid) { exit("Application '{$app_name}' not found\n"); } if (!is_dir("../user/{$dir}")) { exit("../user/{$dir} is not a directory\n"); } make_jobs($dir, $appid, $calibration);
$d = opendir("../user/{$dir}"); while ($file = readdir($d)) { if (!strstr($file, ".png") && !strstr($file, ".jpg")) { continue; } make_job("{$dir}/{$file}", $batchid, $appid); } closedir($d); } function usage() { exit("Usage: bossa_example4_make_jobs.php --dir d\n"); } for ($i = 1; $i < $argc; $i++) { if ($argv[$i] == '--dir') { $dir = $argv[++$i]; } else { usage(); } } if (!$dir) { usage(); } if (!is_dir("../user/{$dir}")) { exit("../user/{$dir} is not a directory\n"); } $appid = bossa_app_lookup("bossa_example4"); if (!$appid) { exit("No application 'bossa_example4'\n"); } make_jobs($dir, $appid);