![]() 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
/**
* Diagnostic script to check James Gibbs' "Dance All Night" track
*/
session_start();
require_once 'config/database.php';
$pdo = getDBConnection();
// Search for the track
$search_term = '%Dance All Night%';
$stmt = $pdo->prepare("
SELECT
mt.*,
u.name as artist_name,
u.email as artist_email
FROM music_tracks mt
JOIN users u ON mt.user_id = u.id
WHERE mt.title LIKE ? OR u.name LIKE 'James%Gibbs%'
ORDER BY mt.created_at DESC
LIMIT 10
");
$stmt->execute([$search_term]);
$tracks = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo "<h1>James Gibbs - Dance All Night Track Diagnostic</h1>";
echo "<style>
body { font-family: Arial, sans-serif; padding: 20px; background: #1a1a1a; color: white; }
table { border-collapse: collapse; width: 100%; margin: 20px 0; background: #2a2a2a; }
th, td { border: 1px solid #444; padding: 12px; text-align: left; }
th { background: #333; color: #ffd700; }
.status-complete { color: #4ade80; }
.status-processing { color: #fbbf24; }
.status-failed { color: #f87171; }
.audio-url { word-break: break-all; max-width: 500px; }
.error { color: #f87171; }
.success { color: #4ade80; }
.warning { color: #fbbf24; }
</style>";
if (empty($tracks)) {
echo "<p class='error'>No tracks found matching 'Dance All Night' or artist 'James Gibbs'</p>";
// Try searching by task_id from callback log
$task_id = '2db928dc-50a7-4dd8-81e1-d8f7e6b01b3f';
$stmt = $pdo->prepare("SELECT mt.*, u.name as artist_name FROM music_tracks mt JOIN users u ON mt.user_id = u.id WHERE mt.task_id = ?");
$stmt->execute([$task_id]);
$track = $stmt->fetch(PDO::FETCH_ASSOC);
if ($track) {
echo "<h2>Found track by task_id:</h2>";
displayTrackInfo($track, $pdo);
} else {
echo "<p class='error'>Track not found by task_id either. Task ID: $task_id</p>";
}
} else {
echo "<h2>Found " . count($tracks) . " track(s):</h2>";
foreach ($tracks as $track) {
displayTrackInfo($track, $pdo);
}
}
function displayTrackInfo($track, $pdo) {
echo "<table>";
echo "<tr><th>Field</th><th>Value</th></tr>";
echo "<tr><td>ID</td><td>" . htmlspecialchars($track['id']) . "</td></tr>";
echo "<tr><td>Task ID</td><td>" . htmlspecialchars($track['task_id']) . "</td></tr>";
echo "<tr><td>Title</td><td>" . htmlspecialchars($track['title']) . "</td></tr>";
echo "<tr><td>Artist</td><td>" . htmlspecialchars($track['artist_name']) . "</td></tr>";
echo "<tr><td>Status</td><td class='status-" . htmlspecialchars($track['status']) . "'>" . htmlspecialchars($track['status']) . "</td></tr>";
echo "<tr><td>Audio URL</td><td class='audio-url'>" . ($track['audio_url'] ? htmlspecialchars($track['audio_url']) : '<span class="error">MISSING!</span>') . "</td></tr>";
echo "<tr><td>Duration</td><td>" . ($track['duration'] ?? 'N/A') . " seconds</td></tr>";
echo "<tr><td>Created</td><td>" . htmlspecialchars($track['created_at']) . "</td></tr>";
echo "<tr><td>Updated</td><td>" . htmlspecialchars($track['updated_at']) . "</td></tr>";
echo "</table>";
// Check if audio URL exists
if ($track['audio_url']) {
$audio_url = $track['audio_url'];
// Check if it's a local file
if (strpos($audio_url, '/') === 0 && !strpos($audio_url, 'http') === 0) {
$local_path = '.' . $audio_url;
if (file_exists($local_path)) {
$file_size = filesize($local_path);
echo "<p class='success'>✅ Local audio file exists: " . $local_path . " (" . round($file_size / 1024 / 1024, 2) . " MB)</p>";
} else {
echo "<p class='error'>❌ Local audio file NOT found: " . $local_path . "</p>";
}
} else {
// It's an external URL
echo "<p class='warning'>⚠️ External audio URL: " . htmlspecialchars($audio_url) . "</p>";
// Test if URL is accessible
$ch = curl_init($audio_url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code == 200) {
echo "<p class='success'>✅ Audio URL is accessible (HTTP $http_code)</p>";
} else {
echo "<p class='error'>❌ Audio URL returned HTTP $http_code (may not be accessible)</p>";
}
}
} else {
echo "<p class='error'>❌ NO AUDIO URL IN DATABASE!</p>";
// Check callback log for this track
$task_id = $track['task_id'];
$callback_log = file_get_contents('callback_log.txt');
if (strpos($callback_log, $task_id) !== false) {
echo "<p class='warning'>⚠️ Track found in callback log. Checking for audio URL...</p>";
// Try to extract audio URL from callback log
$pattern = '/"id":"' . preg_quote($task_id, '/') . '"[^}]*"audio_url":"([^"]+)"/';
if (preg_match($pattern, $callback_log, $matches)) {
$found_audio_url = $matches[1];
echo "<p class='success'>✅ Found audio URL in callback log: " . htmlspecialchars($found_audio_url) . "</p>";
echo "<p><a href='?fix_track=" . $track['id'] . "&audio_url=" . urlencode($found_audio_url) . "' style='color: #4ade80;'>Fix Track - Update Audio URL</a></p>";
}
}
}
// Check task_results file
$task_id = $track['task_id'];
$result_file = "task_results/{$task_id}.json";
if (file_exists($result_file)) {
echo "<p class='success'>✅ Task result file exists: " . $result_file . "</p>";
$result_data = json_decode(file_get_contents($result_file), true);
if ($result_data && isset($result_data['data']['data'][0]['audio_url'])) {
$result_audio_url = $result_data['data']['data'][0]['audio_url'];
echo "<p class='success'>✅ Audio URL in result file: " . htmlspecialchars($result_audio_url) . "</p>";
if (!$track['audio_url']) {
echo "<p><a href='?fix_track=" . $track['id'] . "&audio_url=" . urlencode($result_audio_url) . "' style='color: #4ade80;'>Fix Track - Update from Result File</a></p>";
}
}
} else {
echo "<p class='warning'>⚠️ Task result file not found: " . $result_file . "</p>";
}
echo "<hr style='margin: 30px 0; border-color: #444;'>";
}
// Handle fix request
if (isset($_GET['fix_track']) && isset($_GET['audio_url'])) {
$track_id = (int)$_GET['fix_track'];
$audio_url = $_GET['audio_url'];
$stmt = $pdo->prepare("UPDATE music_tracks SET audio_url = ?, status = 'complete', updated_at = NOW() WHERE id = ?");
if ($stmt->execute([$audio_url, $track_id])) {
echo "<p class='success'>✅ Track updated successfully! Audio URL: " . htmlspecialchars($audio_url) . "</p>";
echo "<p><a href='?' style='color: #4ade80;'>Refresh Page</a></p>";
} else {
echo "<p class='error'>❌ Failed to update track</p>";
}
}
?>