![]() 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/-910246b/ |
<?php
// Manual Task ID Mapper
// This script helps you manually map the correct task IDs from API.box to database tracks
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'config/database.php';
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>Manual Task ID Mapper - SoundStudio Pro</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.success { color: green; }
.error { color: red; }
.warning { color: orange; }
pre { background: #f5f5f5; padding: 10px; border-radius: 5px; margin: 10px 0; }
.test-section { border: 1px solid #ddd; padding: 15px; margin: 15px 0; border-radius: 5px; }
.track-item { border: 1px solid #ccc; padding: 10px; margin: 10px 0; border-radius: 5px; }
.api-box-item { border: 1px solid #4CAF50; padding: 10px; margin: 10px 0; border-radius: 5px; background: #f0f8f0; }
input[type="text"] { width: 300px; padding: 5px; margin: 5px; }
button { background: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; }
button:hover { background: #45a049; }
</style>
</head>
<body>
<h1>🔧 Manual Task ID Mapper</h1>
<?php
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_BASE = 'https://api.api.box';
// Handle form submission
if ($_POST['action'] === 'update_task_id') {
$trackId = $_POST['track_id'];
$newTaskId = $_POST['new_task_id'];
$pdo = getDBConnection();
if ($pdo) {
$stmt = $pdo->prepare("UPDATE music_tracks SET task_id = ? WHERE id = ?");
if ($stmt->execute([$newTaskId, $trackId])) {
echo "<div class='success'>✅ Updated track $trackId with new task ID: $newTaskId</div>";
} else {
echo "<div class='error'>❌ Failed to update track $trackId</div>";
}
}
}
// Handle task ID testing
if ($_POST['action'] === 'test_task_id') {
$taskId = $_POST['test_task_id'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_BASE . '/api/v1/result/' . $taskId);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<div class='test-section'>";
echo "<h3>🔍 Task ID Test Results</h3>";
echo "<p><strong>Task ID:</strong> $taskId</p>";
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($httpCode === 200) {
echo "<p class='success'>✅ Task ID exists in API.box!</p>";
$data = json_decode($response, true);
echo "<pre>" . htmlspecialchars(json_encode($data, JSON_PRETTY_PRINT)) . "</pre>";
if (isset($data['data']['lyrics'])) {
echo "<div class='success'>";
echo "<h4>🎵 Lyrics Found!</h4>";
echo "<pre>" . htmlspecialchars($data['data']['lyrics']) . "</pre>";
echo "</div>";
}
} else {
echo "<p class='error'>❌ Task ID not found in API.box</p>";
if ($response) {
echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
}
echo "</div>";
}
echo "<div class='test-section'>";
echo "<h2>🔍 Database Tracks</h2>";
$pdo = getDBConnection();
if (!$pdo) {
echo "<p class='error'>❌ Cannot connect to database</p>";
exit;
}
// Get tracks that need task ID mapping
$stmt = $pdo->prepare("
SELECT id, title, task_id, status, created_at
FROM music_tracks
WHERE title LIKE '%Feel the Beat%'
OR title LIKE '%Dancing in Circles%'
OR title LIKE '%The Law Revolves%'
ORDER BY created_at DESC
LIMIT 10
");
$stmt->execute();
$tracks = $stmt->fetchAll();
echo "<p><strong>Found " . count($tracks) . " tracks to map:</strong></p>";
foreach ($tracks as $track) {
echo "<div class='track-item'>";
echo "<h4>Track ID: {$track['id']} - {$track['title']}</h4>";
echo "<p><strong>Current Task ID:</strong> {$track['task_id']}</p>";
echo "<p><strong>Status:</strong> {$track['status']}</p>";
echo "<p><strong>Created:</strong> {$track['created_at']}</p>";
// Form to update task ID
echo "<form method='post' style='margin-top: 10px;'>";
echo "<input type='hidden' name='action' value='update_task_id'>";
echo "<input type='hidden' name='track_id' value='{$track['id']}'>";
echo "<label>New Task ID: <input type='text' name='new_task_id' placeholder='Enter API.box task ID'></label>";
echo "<button type='submit'>Update Task ID</button>";
echo "</form>";
echo "</div>";
}
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>🔍 Test Task ID</h2>";
echo "<p>Test if a task ID exists in API.box and get its data:</p>";
echo "<form method='post'>";
echo "<input type='hidden' name='action' value='test_task_id'>";
echo "<label>Task ID to Test: <input type='text' name='test_task_id' placeholder='Enter task ID from API.box'></label>";
echo "<button type='submit'>Test Task ID</button>";
echo "</form>";
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>🔍 API.box Task ID Examples</h2>";
echo "<p>Here are some recent task IDs from our tests:</p>";
echo "<ul>";
echo "<li><strong>Recent Test:</strong> bfd066779de70845df01526724ad9ba7</li>";
echo "<li><strong>New Generated:</strong> 3542c658ae4eef6764c12438f2bb2a27 (Feel the Beat)</li>";
echo "<li><strong>New Generated:</strong> 2499c316d40fa9c8707dbbc391e59669 (Dancing in Circles)</li>";
echo "<li><strong>New Generated:</strong> ff006ec3cd3408d8d2f4c707c0d80aee (The Law Revolves)</li>";
echo "</ul>";
echo "<p><strong>Instructions:</strong></p>";
echo "<ol>";
echo "<li>Go to your API.box logs interface</li>";
echo "<li>Find the 'Feel the Beat' track with lyrics</li>";
echo "<li>Copy the task ID from the API.box interface</li>";
echo "<li>Test it using the form above</li>";
echo "<li>If it works, update the database track with the correct task ID</li>";
echo "</ol>";
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>🔍 Quick Actions</h2>";
echo "<p><strong>After mapping task IDs:</strong></p>";
echo "<ul>";
echo "<li><a href='fetch_existing_lyrics.php' target='_blank'>Run Fetch Lyrics Script</a></li>";
echo "<li><a href='utils/test_lyrics_api.php' target='_blank'>Test Lyrics API</a></li>";
echo "<li><a href='utils/fix_task_ids.php' target='_blank'>Check Task ID Status</a></li>";
echo "</ul>";
echo "</div>";
?>
</body>
</html>