25 lines
1005 B
PHP
25 lines
1005 B
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$out = [];
|
|
|
|
// Latest webm videos - use recursive glob pattern with mtime
|
|
$dirs = glob("/var/www/html/api/playwright-results/*", GLOB_ONLYDIR);
|
|
$webms = [];
|
|
foreach (array_slice($dirs, -20) as $subdir) {
|
|
foreach (glob("$subdir/*.webm") as $w) {
|
|
$webms[] = ["file"=>basename($w), "dir"=>basename($subdir), "size"=>filesize($w), "mtime"=>filemtime($w)];
|
|
}
|
|
}
|
|
usort($webms, function($a,$b){ return $b["mtime"] - $a["mtime"]; });
|
|
$out["latest_webms"] = array_slice(array_map(function($w){
|
|
return ["file"=>$w["file"], "dir"=>$w["dir"], "size_kb"=>round($w["size"]/1024,1), "ts"=>gmdate("c", $w["mtime"])];
|
|
}, $webms), 0, 10);
|
|
|
|
// v76-scripts root files only
|
|
$out["v76_root"] = array_map("basename", array_slice(glob("/var/www/html/api/v76-scripts/*.*"), 0, 20));
|
|
|
|
// playwright php endpoints
|
|
$out["pw_php"] = array_map("basename", glob("/var/www/html/api/*playwright*.php"));
|
|
|
|
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|