diff --git a/new.php b/new.php
index b31ac5d..04a75d0 100644
--- a/new.php
+++ b/new.php
@@ -464,10 +464,15 @@ function paginate($items, $page, $perPage = 8){
}
function page_links($tab, $page, $pages){
if ($pages <= 1) return '';
+ $extra = '';
+ if ($tab === 'edit') {
+ $q = trim((string)($_GET['q'] ?? ''));
+ if ($q !== '') $extra .= '&q=' . rawurlencode($q);
+ }
$html = '
';
for ($i = 1; $i <= $pages; $i++) {
$class = $i === $page ? 'active' : '';
- $html .= '
'.$i.'';
+ $html .= '
'.$i.'';
}
return $html . '
';
}
@@ -663,6 +668,38 @@ $dirInfo = load_input_dir_cache($dirs);
sort_input_dirs_by_metadata_date($dirs, $dirInfo);
$orphanVideos = orphan_videos($config);
$tab = $_GET['tab'] ?? 'edit';
+
+$rawKeyword = trim((string)($_GET['q'] ?? ''));
+$keywordType = 'general';
+$keywordValue = $rawKeyword;
+if ($rawKeyword !== '' && preg_match('/^\s*(date|location|place)\s*=\s*(.+)\s*$/i', $rawKeyword, $m)) {
+ $keywordType = strtolower((string)$m[1]);
+ if ($keywordType === 'place') $keywordType = 'location';
+ $keywordValue = trim((string)$m[2]);
+}
+if ($keywordValue !== '') {
+ $dirs = array_values(array_filter($dirs, function($dir) use ($keywordType, $keywordValue, $config) {
+ $data = read_data($dir);
+ $state = input_dir_state($dir);
+ $fullOutput = basename((string)($state['output'] ?? ''));
+ $previewOutput = basename((string)($state['preview_output'] ?? ''));
+ $hasFullVideo = $fullOutput !== '' && is_file($config['videos_dir'].'/'.$fullOutput);
+ $hasPreviewVideo = $previewOutput !== '' && is_file($config['videos_dir'].'/'.$previewOutput);
+ $preview = input_dir_preview($dir);
+ $displayOutput = ($preview && $hasPreviewVideo) ? $previewOutput : ($hasFullVideo ? $fullOutput : ($hasPreviewVideo ? $previewOutput : ''));
+ $meta = cached_video_metadata($displayOutput, $data);
+
+ $title = (string)($meta['title'] ?: ($data['title'] ?: basename($dir)));
+ $description = (string)($meta['description'] ?? ($data['description'] ?? ''));
+ $date = (string)($meta['date'] ?? ($data['date'] ?? ''));
+ $location = (string)($meta['location'] ?? ($data['place'] ?? ''));
+
+ if ($keywordType === 'date') return stripos($date, $keywordValue) !== false;
+ if ($keywordType === 'location') return stripos($location, $keywordValue) !== false;
+ return stripos($title, $keywordValue) !== false || stripos($description, $keywordValue) !== false;
+ }));
+}
+
$page = max(1, (int)($_GET['page'] ?? 1));
[$editPage, $editPages, $dirsPage, $dirsTotal] = paginate($dirs, $tab === 'edit' ? $page : 1);
[$videoPage, $videoPages, $orphanVideosPage, $orphanVideosTotal] = paginate($orphanVideos, $tab === 'videos' ? $page : 1);
@@ -671,13 +708,13 @@ $editDir = null; $editStatus = ''; $editRunning = false; $editData = ['title'=>'
if ($editName !== '') { try { $editDir = safe_input_dir($config['uploads_dir'], $editName); $editStatus = input_dir_status($editDir); $editRunning = input_dir_running($editDir); if (!$editRunning) { $editData = read_data($editDir); $editFiles = media_sort_files($editDir, list_files($editDir)); } } catch (Throwable $e) { $err = $e->getMessage(); } }
$runningJobs = active_worker_jobs($config);
?>
-