diff --git a/new.php b/new.php index 3c9750a..c6f1d9d 100644 --- a/new.php +++ b/new.php @@ -7,13 +7,15 @@ if (!is_dir(__DIR__ . "/cache")) mkdir(__DIR__ . "/cache", 0775, true); function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, "UTF-8"); } function ajax_json($data){ header('Content-Type: application/json; charset=UTF-8'); echo json_encode($data, JSON_UNESCAPED_UNICODE); exit; } function run_gpsmap($dir) { + file_put_contents("/var/www/html/mvlog/gps_err.log", "DEBUG: run_gpsmap called for " . $dir . " +", FILE_APPEND); $stateFile = $dir . '/.movmaker-state.json'; $state = is_file($stateFile) ? json_decode((string)file_get_contents($stateFile), true) : []; $output = basename((string)($state['output'] ?? '')); $map_filename = ($output !== '' ? pathinfo($output, PATHINFO_FILENAME) : basename($dir)) . '.png'; $out_path = '/var/www/html/mvlog/out-dir/' . $map_filename; - $cmd = "python3 /var/www/html/mvlog/bin/gpsmap.py " . escapeshellarg($dir) . " " . escapeshellarg($out_path) . " > /dev/null 2>&1 &"; - shell_exec($cmd); + $cmd = "/usr/bin/python3 /var/www/html/mvlog/bin/gpsmap.py " . escapeshellarg($dir) . " " . escapeshellarg($out_path) . " >> /var/www/html/mvlog/gps_err.log 2>&1 &"; + $cmd = "PATH=/usr/bin:/usr/local/bin " . $cmd; shell_exec($cmd); } function slugify($s){ $s = strtolower(trim($s)); $s = preg_replace('/[^a-z0-9]+/', '-', $s); return trim($s, '-') ?: 'movie'; } function rrmdir($dir){ if(!is_dir($dir)) return; foreach(scandir($dir) as $f){ if($f==='.'||$f==='..') continue; $p="$dir/$f"; is_dir($p)?rrmdir($p):unlink($p);} rmdir($dir); } @@ -75,7 +77,6 @@ function write_data($dir, $post){ if ($fileName !== '' && $caption !== '') $lines[] = $fileName . ': ' . $caption; } } - file_put_contents($dir . '/data.txt', implode("\n", $lines) . "\n"); } function editable_file($f){ $ext = strtolower(pathinfo((string)$f, PATHINFO_EXTENSION)); return $f !== '' && $f[0] !== '.' && $f !== 'data.txt' && in_array($ext, ['jpg','jpeg','png','webp','gif','mp4','mov','m4v','avi','mkv','webm','mp3','wav','m4a','aac','ogg','flac'], true); } function natural_file_compare($a, $b){ return strnatcasecmp((string)$a, (string)$b); } @@ -152,7 +153,7 @@ for dirpath, dirnames, filenames in os.walk(root): entries.sort() print(hashlib.sha256(json.dumps(entries, ensure_ascii=False, separators=(',', ':')).encode('utf-8')).hexdigest()) PY; - $cmd = 'python3 -c ' . escapeshellarg($script) . ' ' . escapeshellarg($dir); + $cmd = '/usr/bin/python3 -c ' . escapeshellarg($script) . ' ' . escapeshellarg($dir); $output = trim(shell_exec($cmd) ?? ''); return $output !== '' ? $output : ''; } @@ -185,7 +186,6 @@ function load_input_dir_cache($dirs){ } } if (array_diff(array_keys($oldItems), array_keys($items))) $changed = true; - if ($changed) file_put_contents($cacheFile, json_encode(['version'=>1,'generated_at'=>date('c'),'items'=>$items], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT), LOCK_EX); return $items; } function sort_input_dirs_by_metadata_date(&$dirs, $dirInfo){ @@ -243,15 +243,15 @@ function set_input_dir_preview($dir, $preview){ if (!is_array($state)) $state = []; $state['preview'] = (bool)$preview; $state['preview_updated_at'] = gmdate('c'); - file_put_contents($stateFile, json_encode($state, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . " -"); + file_put_contents($stateFile, json_encode($state, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) . "\n"); chmod($stateFile, 0664); } function input_dir_visible($dir){ return !is_file($dir . '/.mvlog-hidden'); } function set_input_dir_visible($dir, $visible){ $path = $dir . '/.mvlog-hidden'; if ($visible) { if (is_file($path)) unlink($path); } - else { file_put_contents($path, "hidden\n"); chmod($path, 0664); } + else { file_put_contents($path, "hidden +"); chmod($path, 0664); } } function input_dir_state($dir){ $stateFile = $dir . '/.movmaker-state.json'; @@ -423,7 +423,6 @@ try { include_once __DIR__ . '/lib/send_push.php'; try_send_show_notification(basename($dir), $dir, __DIR__, '/var/log/mvlog_notify.log'); } else { - error_log("[mvlog] send_push helper missing, cannot send notification for " . basename($dir) . "\n", 3, '/var/log/mvlog_notify.log'); } } diff --git a/style.css b/style.css index 3e5df7c..b9fbbb8 100644 --- a/style.css +++ b/style.css @@ -61,3 +61,7 @@ border-radius: .5rem; margin-top: 1rem; } +.video-wrapper { + display: flex; + flex-direction: column; +}