Upload file test-api-live.php via GUI

This commit is contained in:
2026-03-29 22:28:46 +02:00
parent 32fb4c8204
commit 3e7aaf3560

View File

@@ -0,0 +1,80 @@
<?php
/**
* Test das neue API-basierte Livestream-System
*/
define('WP_USE_THEMES', false);
require('../../../wp-load.php');
echo "=== Test API-basiertes Livestream-System ===\n\n";
// 1. Check Customizer Settings
$api_key = get_theme_mod('youtube_api_key');
$handle = get_theme_mod('youtube_livestream_handle', '@DreamTripspk');
echo "1. Customizer Settings:\n";
echo " API Key: " . ($api_key ? "SET (" . strlen($api_key) . " chars)" : "NOT SET") . "\n";
echo " Handle: " . ($handle ? $handle : "NOT SET") . "\n\n";
if (empty($api_key)) {
echo "⚠️ WARNUNG: Kein API Key gesetzt. Ohne API Key funktioniert das neue System nicht!\n";
echo " Bitte im Customizer unter 'Video & Livestream' einen YouTube API Key eintragen.\n\n";
}
if (empty($handle)) {
echo "⚠️ WARNUNG: Kein Handle gesetzt.\n";
echo " Bitte im Customizer unter 'Video & Livestream' einen YouTube @Handle eintragen.\n\n";
}
// 2. Test Channel ID Resolution
if (!empty($handle)) {
echo "2. Channel ID Resolution:\n";
$channel_id = mm_get_channel_id_by_handle($handle);
if ($channel_id) {
echo " ✓ Channel ID: $channel_id\n\n";
// 3. Test Live Video Detection
echo "3. Live Video Detection:\n";
$live_id = mm_get_youtube_live_id_from_handle($handle);
if ($live_id) {
echo " ✓ LIVE! Video ID: $live_id\n";
echo " ✓ URL: https://www.youtube.com/watch?v=$live_id\n\n";
} else {
echo " ✗ Nicht live oder keine Videos gefunden\n\n";
}
} else {
echo " ✗ Channel ID konnte nicht ermittelt werden\n";
echo " Prüfe ob der Handle korrekt ist und API Key gültig ist\n\n";
}
}
// 4. Test mm_video_get_livestream_groups()
echo "4. Test mm_video_get_livestream_groups():\n";
$groups = mm_video_get_livestream_groups();
echo " Debug: Returned value type: " . gettype($groups) . "\n";
echo " Debug: Is array: " . (is_array($groups) ? 'yes' : 'no') . "\n";
echo " Debug: Count: " . count($groups) . "\n";
if (!empty($groups)) {
echo "" . count($groups) . " Gruppe(n) gefunden\n";
foreach ($groups as $i => $group) {
echo " Gruppe $i:\n";
echo " - Title: " . $group['title'] . "\n";
echo " - Platform: " . $group['platform'] . "\n";
echo " - YT ID: " . $group['yt_id'] . "\n";
echo " - Handle: " . $group['handle'] . "\n";
}
} else {
echo " ✗ Keine Gruppen (kein Live-Stream aktiv)\n";
echo " Debug: Testing internal call...\n";
$test_handle = get_theme_mod('youtube_livestream_handle', '');
echo " Debug: Handle from theme_mod: '" . $test_handle . "'\n";
$test_live_id = mm_get_youtube_live_id_from_handle($test_handle);
echo " Debug: Live ID from internal call: '" . ($test_live_id ? $test_live_id : 'false') . "'\n";
}
echo "\n=== Test Complete ===\n";
echo "\nNächste Schritte:\n";
echo "1. Gehe zu Design → Customizer → Video & Livestream\n";
echo "2. Trage deinen YouTube API Key ein\n";
echo "3. Trage deinen @Handle ein (z.B. @DreamTripspk)\n";
echo "4. Speichern und Seite neu laden\n";