![]() 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/.cursor-server/data/User/History/-728cc0e6/ |
<?php
/**
* Fix Stephane Bergeron's Tracks
*
* This script manually creates real API.Box tasks for Stephane's failed tracks
* that have temporary task IDs.
*/
require_once 'config/database.php';
$pdo = getDBConnection();
$api_key = '63edba40620216c5aa2c04240ac41dbd';
echo "<h1>🔧 Fixing Stephane Bergeron's Tracks</h1>";
// Get Stephane's failed tracks with temporary task IDs
$stmt = $pdo->prepare("
SELECT * FROM music_tracks
WHERE user_id = 5
AND status = 'failed'
AND task_id LIKE 'temp_%'
ORDER BY created_at DESC
");
$stmt->execute();
$tracks = $stmt->fetchAll();
echo "<h2>📊 Found " . count($tracks) . " tracks to fix</h2>";
foreach ($tracks as $track) {
echo "<h3>🔍 Track: " . htmlspecialchars($track['title']) . " (ID: {$track['id']})</h3>";
echo "<p><strong>Prompt:</strong> " . htmlspecialchars($track['prompt']) . "</p>";
echo "<p><strong>Music Type:</strong> {$track['music_type']}</p>";
echo "<p><strong>Model Version:</strong> {$track['model_version']}</p>";
echo "<p><strong>Duration:</strong> {$track['duration']}s</p>";
// Create real API.Box task
$api_url = 'https://api.api.box/api/v1/generate';
$post_data = [
'prompt' => $track['prompt'],
'model' => $track['model_version'],
'style' => 'Pop',
'title' => $track['title'],
'customMode' => true,
'instrumental' => false,
'duration' => $track['duration'],
'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $api_key,
'Content-Type: application/json',
'User-Agent: SoundStudioPro-Fix/1.0'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code === 200) {
$api_response = json_decode($response, true);
if ($api_response && isset($api_response['data']['task_id'])) {
$real_task_id = $api_response['data']['task_id'];
// Update the track with the real task ID and set status to processing
$stmt = $pdo->prepare("
UPDATE music_tracks
SET task_id = ?, status = 'processing', updated_at = NOW()
WHERE id = ?
");
if ($stmt->execute([$real_task_id, $track['id']])) {
echo "<p style='color: green;'>✅ SUCCESS: Created real API.Box task!</p>";
echo "<p><strong>New Task ID:</strong> $real_task_id</p>";
echo "<p><strong>Status:</strong> processing</p>";
echo "<p>The track will now be monitored automatically and updated when complete.</p>";
} else {
echo "<p style='color: red;'>❌ Failed to update database</p>";
}
} else {
echo "<p style='color: red;'>❌ Invalid API response</p>";
echo "<p>Response: " . htmlspecialchars($response) . "</p>";
}
} else {
echo "<p style='color: red;'>❌ API request failed (HTTP $http_code)</p>";
echo "<p>Response: " . htmlspecialchars($response) . "</p>";
}
echo "<hr>";
}
echo "<h2>🎯 Next Steps</h2>";
echo "<p>1. The tracks are now being processed by API.Box</p>";
echo "<p>2. The automatic monitoring system will update them when complete</p>";
echo "<p>3. Stephane will see them as 'processing' instead of 'failed'</p>";
echo "<p>4. They will automatically become 'complete' when ready</p>";
echo "<h3>🔍 To monitor progress:</h3>";
echo "<p>Check the monitor log: <code>tail -f monitor_log.txt</code></p>";
echo "<p>Or run the monitor manually: <code>php auto_monitor.php</code></p>";
echo "<p style='color: green; font-weight: bold;'>🎵 Stephane's tracks are now being properly processed!</p>";
?>