Trace web UI troubleshooting changes
This commit is contained in:
parent
eed092d872
commit
a600e035d5
2 changed files with 38 additions and 6 deletions
25
index.php
25
index.php
|
|
@ -64,6 +64,26 @@ function map_hidden_outputs($config){
|
|||
return $hidden;
|
||||
}
|
||||
|
||||
function shown_video_paths($config){
|
||||
$videos = [];
|
||||
$seen = [];
|
||||
foreach (glob($config['uploads_dir'].'/*', GLOB_ONLYDIR) ?: [] as $dir) {
|
||||
// Public index shows only items explicitly enabled with the admin "Show" switch.
|
||||
if (is_file($dir . '/.mvlog-hidden')) continue;
|
||||
$stateFile = $dir . '/.movmaker-state.json';
|
||||
if (!is_file($stateFile)) continue;
|
||||
$state = json_decode((string)file_get_contents($stateFile), true);
|
||||
if (!is_array($state)) continue;
|
||||
$name = basename((string)($state['output'] ?? ''));
|
||||
if ($name === '' || preg_match('/_preview\.(mp4|webm|mov|m4v)$/i', $name)) continue;
|
||||
$path = $config['videos_dir'] . '/' . $name;
|
||||
if (!is_file($path) || isset($seen[$name])) continue;
|
||||
$seen[$name] = true;
|
||||
$videos[] = $path;
|
||||
}
|
||||
return $videos;
|
||||
}
|
||||
|
||||
function public_url_path($path){
|
||||
$path = str_replace('\\', '/', trim((string)$path));
|
||||
if ($path === '') return '';
|
||||
|
|
@ -269,10 +289,7 @@ function load_video_cache($videos){
|
|||
|
||||
$hiddenOutputs = hidden_video_outputs($config);
|
||||
$hiddenMapOutputs = map_hidden_outputs($config);
|
||||
$allVideos = array_values(array_filter(
|
||||
glob($config['videos_dir'].'/*.{mp4,webm,mov,m4v}', GLOB_BRACE) ?: [],
|
||||
fn($v)=>!preg_match('/_preview\.(mp4|webm|mov|m4v)$/i', basename($v))
|
||||
));
|
||||
$allVideos = shown_video_paths($config);
|
||||
|
||||
$videoCache = load_video_cache($allVideos);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue