/** * Re-process all of the video for an existing test * * @param mixed $id */ function ReprocessVideo($id) { $testPath = './' . GetTestPath($id); if (is_dir($testPath)) { $lock = LockTest($id); if (isset($lock)) { $cacheFiles = glob("{$testPath}/*.dat.gz"); if ($cacheFiles && is_array($cacheFiles) && count($cacheFiles)) { foreach ($cacheFiles as $cacheFile) { unlink($cacheFile); } } $videoFiles = glob("{$testPath}/*.mp4"); if ($videoFiles && is_array($videoFiles) && count($videoFiles)) { foreach ($videoFiles as $video) { if (preg_match('/^.*\\/(?P<run>[0-9]+)(?P<cached>_Cached)?_video\\.mp4$/i', $video, $matches)) { $run = $matches['run']; $cached = array_key_exists('cached', $matches) ? 1 : 0; $videoDir = "{$testPath}/video_{$run}"; if ($cached) { $videoDir .= '_cached'; } delTree($videoDir, false); ProcessAVIVideo($id, $testPath, $run, $cached); } } } UnlockTest($lock); } } }
if (isset($runNumber) && isset($cacheWarmed)) { if ($testInfo['fvonly'] || $cacheWarmed) { if (!array_key_exists('test_runs', $testInfo)) { $testInfo['test_runs'] = array(); } if (array_key_exists($runNumber, $testInfo['test_runs'])) { $testInfo['test_runs'][$runNumber]['done'] = true; } else { $testInfo['test_runs'][$runNumber] = array('done' => true); } $testInfo_dirty = true; } if ($testInfo['video']) { $workdone_video_start = microtime(true); } ProcessAVIVideo($testInfo, $testPath, $runNumber, $cacheWarmed, $max_load); if ($testInfo['video']) { $workdone_video_end = microtime(true); } } if (strlen($location) && strlen($tester)) { $testerInfo = array(); $testerInfo['ip'] = $_SERVER['REMOTE_ADDR']; if (!isset($testerError)) { $testerError = false; } if (array_key_exists('testerror', $_REQUEST) && strlen($_REQUEST['testerror'])) { $testerError = $_REQUEST['testerror']; } elseif (array_key_exists('error', $_REQUEST) && strlen($_REQUEST['error'])) { $testerError = $_REQUEST['error']; }
protected function ProcessVideo(&$test, $tempdir, $testPath, $index) { if (is_file("{$tempdir}/appurify_results/video.mp4")) { rename("{$tempdir}/appurify_results/video.mp4", "{$testPath}/{$index}_appurify.mp4"); require_once './video/avi2frames.inc.php'; ProcessAVIVideo($test, $testPath, $index, 0); } }