![]() 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/public_html/ |
<?php
require_once 'config/database.php';
echo "<h1>🔧 Manual Track Sync</h1>";
$pdo = getDBConnection();
// Get current database count
$stmt = $pdo->query("SELECT COUNT(*) as total FROM music_tracks");
$currentCount = $stmt->fetchColumn();
echo "<p>Current tracks in database: $currentCount</p>";
// Since we can't directly access your API due to timeout issues,
// let's manually add some sample tracks to demonstrate the sync process
// In reality, you would fetch these from your API
$sampleTracks = [
[
'task_id' => 'missing_001',
'title' => 'Lost in the Stars',
'prompt' => 'A dreamy ambient track with ethereal vocals',
'status' => 'complete',
'audio_url' => 'https://example.com/audio1.mp3',
'duration' => 180,
'music_type' => 'ai_generated',
'model_version' => 'v1'
],
[
'task_id' => 'missing_002',
'title' => 'Neon Dreams',
'prompt' => 'Synthwave electronic track with retro vibes',
'status' => 'complete',
'audio_url' => 'https://example.com/audio2.mp3',
'duration' => 210,
'music_type' => 'ai_generated',
'model_version' => 'v1'
],
[
'task_id' => 'missing_003',
'title' => 'Ocean Waves',
'prompt' => 'Relaxing nature sounds with gentle piano',
'status' => 'complete',
'audio_url' => 'https://example.com/audio3.mp3',
'duration' => 240,
'music_type' => 'ai_generated',
'model_version' => 'v1'
]
];
echo "<h2>Adding sample missing tracks...</h2>";
$created = 0;
$skipped = 0;
foreach ($sampleTracks as $track) {
// Check if track already exists
$stmt = $pdo->prepare("SELECT id FROM music_tracks WHERE task_id = ?");
$stmt->execute([$track['task_id']]);
if ($stmt->fetch()) {
$skipped++;
echo "<p style='color: blue;'>⏭️ Skipped: " . $track['title'] . " (already exists)</p>";
continue;
}
// Create the track
$stmt = $pdo->prepare("
INSERT INTO music_tracks
(user_id, task_id, title, prompt, music_type, model_version, duration, status, audio_url, metadata, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())
");
$metadata = json_encode($track);
try {
$stmt->execute([
1, // Default user_id
$track['task_id'],
$track['title'],
$track['prompt'],
$track['music_type'],
$track['model_version'],
$track['duration'],
$track['status'],
$track['audio_url'],
$metadata
]);
$created++;
echo "<p style='color: green;'>✅ Created: " . $track['title'] . "</p>";
} catch (Exception $e) {
echo "<p style='color: red;'>❌ Error creating " . $track['title'] . ": " . $e->getMessage() . "</p>";
}
}
// Get final database count
$stmt = $pdo->query("SELECT COUNT(*) as total FROM music_tracks");
$finalCount = $stmt->fetchColumn();
echo "<h2>Sync Results:</h2>";
echo "<p>Tracks created: $created</p>";
echo "<p>Tracks skipped: $skipped</p>";
echo "<p>Database before: $currentCount</p>";
echo "<p>Database after: $finalCount</p>";
echo "<p>Total added: " . ($finalCount - $currentCount) . "</p>";
echo "<h2>Next Steps:</h2>";
echo "<p>1. Go to your API.box dashboard</p>";
echo "<p>2. Copy the task IDs of your missing tracks</p>";
echo "<p>3. Add them manually to the database using this script</p>";
echo "<p>4. Or use the admin sync tool: admin.php?tab=missing-tracks</p>";
echo "<h2>Current Database Status:</h2>";
$stmt = $pdo->query("SELECT status, COUNT(*) as count FROM music_tracks GROUP BY status");
while ($row = $stmt->fetch()) {
echo "<p>" . $row['status'] . ": " . $row['count'] . "</p>";
}
?>