feat: photo gallery indexing — one record per folder, full filename search

scanner/scan_disc.py:
- Inventory disc into video files + photo folders (grouped by directory)
- Photo extensions: jpg/jpeg/png/gif/tiff/bmp/heic/heif/webp + raw formats
  (cr2 cr3 nef arw dng orf rw2 raf)
- Video disc   → 1 record per disc with video file list
- Photo disc   → 1 record per gallery folder with photo list
- Mixed disc   → both: 1 video record + 1 record per photo folder
- Unknown disc → 1 fallback record with total file count
- Folder title format: "DISC_LABEL — Folder / Subfolder"

videodb/api_ingest.php:
- Add subtitle field (gallery folder path)
- Add plot field (TEXT — full filename list, no 255-char limit)
- Add custom3 field (content type: video | photo | mixed | data)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 10:15:56 +02:00
parent 451afc0440
commit 7d401b1963
2 changed files with 198 additions and 104 deletions

View File

@@ -62,19 +62,22 @@ if (!$dbh) {
}
// ── Sanitize inputs ───────────────────────────────────────────────────────────
$title = mysqli_real_escape_string($dbh, substr($data['title'], 0, 255));
$mediatype = (int)($data['mediatype'] ?? 1); // 1=DVD, 16=Blu-ray, 18=CD
$comment = mysqli_real_escape_string($dbh, substr($data['comment'] ?? '', 0, 255));
$filesize = (int)($data['filesize'] ?? 0);
$custom1 = mysqli_real_escape_string($dbh, substr($data['custom1'] ?? '', 0, 255)); // raw drutil type
$custom2 = mysqli_real_escape_string($dbh, substr($data['custom2'] ?? '', 0, 255)); // track count / file count
$title = mysqli_real_escape_string($dbh, substr($data['title'] ?? '', 0, 255));
$subtitle = mysqli_real_escape_string($dbh, substr($data['subtitle'] ?? '', 0, 255)); // gallery folder path
$mediatype = (int)($data['mediatype'] ?? 1);
$comment = mysqli_real_escape_string($dbh, substr($data['comment'] ?? '', 0, 255));
$plot = mysqli_real_escape_string($dbh, $data['plot'] ?? ''); // full file listing (TEXT, no limit)
$filesize = (int)($data['filesize'] ?? 0);
$custom1 = mysqli_real_escape_string($dbh, substr($data['custom1'] ?? '', 0, 255)); // disc type string
$custom2 = mysqli_real_escape_string($dbh, substr($data['custom2'] ?? '', 0, 255)); // file/photo count
$custom3 = mysqli_real_escape_string($dbh, substr($data['custom3'] ?? '', 0, 255)); // content type: video|photo|mixed
$disklabel = mysqli_real_escape_string($dbh, substr($data['disklabel'] ?? '', 0, 32));
// ── Insert ────────────────────────────────────────────────────────────────────
$sql = "INSERT INTO " . TBL_DATA . "
(title, mediatype, comment, filesize, disklabel, custom1, custom2, created, owner_id)
(title, subtitle, mediatype, comment, plot, filesize, disklabel, custom1, custom2, custom3, created, owner_id)
VALUES
('$title', $mediatype, '$comment', $filesize, '$disklabel', '$custom1', '$custom2', NOW(), 1)";
('$title', '$subtitle', $mediatype, '$comment', '$plot', $filesize, '$disklabel', '$custom1', '$custom2', '$custom3', NOW(), 1)";
if (mysqli_query($dbh, $sql)) {
$id = (int)mysqli_insert_id($dbh);