![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/ |
<?php
/**
* Verify Failed Track Error Messages
*
* This script shows the exact error messages stored in metadata for all failed tracks
* to confirm they have the correct error messages from the API
*/
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'config/database.php';
echo "<!DOCTYPE html>
<html>
<head>
<title>Verify Failed Track Error Messages</title>
<style>
body { font-family: Arial, sans-serif; padding: 20px; background: #f5f5f5; }
.track { background: white; padding: 15px; margin: 10px 0; border-radius: 8px; border-left: 4px solid #667eea; }
.success { color: #10b981; }
.error { color: #ef4444; }
.warning { color: #f59e0b; }
.info { color: #3b82f6; }
h1 { color: #1a1a2e; }
h2 { color: #667eea; margin-top: 30px; }
.summary { background: white; padding: 20px; border-radius: 8px; margin-top: 20px; }
pre { background: #f8f9fa; padding: 10px; border-radius: 4px; overflow-x: auto; font-size: 12px; }
.error-msg { background: #fef2f2; border-left: 4px solid #ef4444; padding: 10px; margin: 10px 0; }
.good-msg { background: #f0fdf4; border-left: 4px solid #10b981; padding: 10px; margin: 10px 0; }
.no-msg { background: #fffbeb; border-left: 4px solid #f59e0b; padding: 10px; margin: 10px 0; }
</style>
</head>
<body>";
echo "<h1>🔍 Verify Failed Track Error Messages</h1>";
echo "<p>This script shows the exact error messages stored in metadata for all failed tracks.</p>";
echo "<hr>";
$pdo = getDBConnection();
if (!$pdo) {
die("<p class='error'>❌ Database connection failed</p>");
}
// Get all failed tracks
$stmt = $pdo->prepare("
SELECT id, task_id, title, user_id, status, metadata, created_at
FROM music_tracks
WHERE status = 'failed'
ORDER BY created_at DESC
LIMIT 500
");
$stmt->execute();
$failedTracks = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<p><strong>Found " . count($failedTracks) . " failed tracks</strong></p>";
echo "<hr>";
$stats = [
'with_exact_error' => 0,
'with_generic_error' => 0,
'no_error_message' => 0,
'has_artist_name_error' => 0
];
foreach ($failedTracks as $track) {
$trackId = $track['id'];
$taskId = $track['task_id'];
$title = htmlspecialchars($track['title'] ?? 'Untitled');
$metadata = json_decode($track['metadata'] ?? '{}', true);
echo "<div class='track'>";
echo "<h3>Track #{$trackId}: {$title}</h3>";
echo "<p><strong>Task ID:</strong> " . ($taskId ? substr($taskId, 0, 30) . '...' : 'N/A') . " | <strong>Created:</strong> " . $track['created_at'] . "</p>";
if ($metadata) {
$error_msg = $metadata['msg'] ??
$metadata['error'] ??
$metadata['error_msg'] ??
$metadata['message'] ??
null;
$error_code = $metadata['code'] ?? null;
$error_type = $metadata['error_type'] ?? null;
if ($error_msg) {
// Check if it's the exact error message we want
$error_lower = strtolower($error_msg);
$has_artist_name = strpos($error_lower, 'song description') !== false ||
strpos($error_lower, 'contained artist name') !== false;
if ($has_artist_name) {
echo "<div class='good-msg'>";
echo "<strong>✅ Exact Error Message Found:</strong><br>";
echo "<strong>Code:</strong> " . ($error_code ?? 'N/A') . " | <strong>Type:</strong> " . ($error_type ?? 'N/A') . "<br>";
echo "<strong>Message:</strong> " . htmlspecialchars($error_msg);
echo "</div>";
$stats['with_exact_error']++;
$stats['has_artist_name_error']++;
} elseif (strlen($error_msg) > 30 && $error_msg !== 'Generation failed') {
echo "<div class='good-msg'>";
echo "<strong>✅ Error Message Found:</strong><br>";
echo "<strong>Code:</strong> " . ($error_code ?? 'N/A') . " | <strong>Type:</strong> " . ($error_type ?? 'N/A') . "<br>";
echo "<strong>Message:</strong> " . htmlspecialchars($error_msg);
echo "</div>";
$stats['with_exact_error']++;
} else {
echo "<div class='no-msg'>";
echo "<strong>⚠️ Generic Error Message:</strong><br>";
echo "<strong>Code:</strong> " . ($error_code ?? 'N/A') . " | <strong>Type:</strong> " . ($error_type ?? 'N/A') . "<br>";
echo "<strong>Message:</strong> " . htmlspecialchars($error_msg);
echo "</div>";
$stats['with_generic_error']++;
}
} else {
echo "<div class='error-msg'>";
echo "<strong>❌ No Error Message in Metadata</strong>";
echo "</div>";
$stats['no_error_message']++;
}
// Show full metadata for debugging
echo "<details style='margin-top: 10px;'>";
echo "<summary style='cursor: pointer; color: #667eea;'>📋 View Full Metadata</summary>";
echo "<pre>" . htmlspecialchars(json_encode($metadata, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) . "</pre>";
echo "</details>";
} else {
echo "<div class='error-msg'>";
echo "<strong>❌ No Metadata Found</strong>";
echo "</div>";
$stats['no_error_message']++;
}
echo "</div>";
}
echo "<hr>";
echo "<div class='summary'>";
echo "<h2>📊 Summary</h2>";
echo "<div><strong>Tracks with Exact Error Messages:</strong> <span class='success'>{$stats['with_exact_error']}</span></div>";
echo "<div><strong>Tracks with 'Song Description contained artist name' errors:</strong> <span class='success'>{$stats['has_artist_name_error']}</span></div>";
echo "<div><strong>Tracks with Generic Error Messages:</strong> <span class='warning'>{$stats['with_generic_error']}</span></div>";
echo "<div><strong>Tracks with No Error Message:</strong> <span class='error'>{$stats['no_error_message']}</span></div>";
echo "</div>";
echo "<p style='margin-top: 30px;'><a href='fix_all_failed_tracks.php'>🔧 Run Fix Script</a> | <a href='admin.php?tab=track-status'>← Back to Admin</a></p>";
echo "</body></html>";
?>