Metadata
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
$file = $argv[1] ?? '/var/www/cache/guide.json';
|
||||
|
||||
if (!file_exists($file)) {
|
||||
fwrite(STDERR, "Datei nicht gefunden: {$file}\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents($file), true);
|
||||
|
||||
if (!is_array($data)) {
|
||||
fwrite(STDERR, "JSON ungültig.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$patterns = [];
|
||||
$samples = [];
|
||||
|
||||
foreach ($data['channels'] ?? [] as $channel) {
|
||||
foreach ($channel['programmes'] ?? [] as $programme) {
|
||||
$subtitle = trim($programme['subtitle'] ?? '');
|
||||
|
||||
if ($subtitle === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$parts = array_map('trim', explode('║', $subtitle));
|
||||
$count = count($parts);
|
||||
|
||||
$key = $count . ' Teile';
|
||||
|
||||
$patterns[$key] = ($patterns[$key] ?? 0) + 1;
|
||||
|
||||
if (!isset($samples[$key])) {
|
||||
$samples[$key] = $subtitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arsort($patterns);
|
||||
|
||||
echo "Rytec Subtitle Analyse\n";
|
||||
echo "======================\n\n";
|
||||
|
||||
foreach ($patterns as $pattern => $count) {
|
||||
echo str_pad($pattern, 12) . str_pad((string)$count, 8, ' ', STR_PAD_LEFT) . "\n";
|
||||
echo " Beispiel: " . $samples[$pattern] . "\n\n";
|
||||
}
|
||||
Reference in New Issue
Block a user