Text-Map. * Ergebnis: App/sims/heli/scripts/audio-texts.json * * Aufruf: http://localhost/geograsim/App/php/build-audio-texts.php */ header('Content-Type: text/plain; charset=utf-8'); $scriptsDir = __DIR__ . '/../sims/heli/scripts'; $texts = []; $files = 0; foreach (glob($scriptsDir . '/*.json') as $f) { $base = basename($f); if ($base === 'audio-texts.json') continue; // sich selbst ueberspringen if ($base === 'speakers.json') continue; // Mapping, kein Text if (strpos($base, 'drehbuch') !== false) continue; // Drehbuch-Profile, kein Text $j = json_decode(file_get_contents($f), true); if (!$j || empty($j['lines'])) continue; $files++; foreach ($j['lines'] as $l) { if (!empty($l['id']) && !empty($l['text'])) { $texts[$l['id']] = $l['text']; } } } ksort($texts); $out = $scriptsDir . '/audio-texts.json'; file_put_contents($out, json_encode($texts, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); echo "Quellen: $files Dateien\n"; echo "Audio-IDs: " . count($texts) . "\n"; echo "Geschrieben: $out\n";