debug(05-jamtrack): add package structure logging for debugging

Added console.log statements to inspect the actual package data structure
returned from the REST API. This will help identify:
- Correct field names (snake_case vs camelCase)
- Actual values for file_type, encrypt_type, sample_rate
- Available packages for debugging "No compatible package" errors

Also updated the compatiblePackage search to check both naming conventions:
- pkg.file_type or pkg.fileType
- pkg.encrypt_type or pkg.encryptType
- pkg.sample_rate or pkg.sampleRate

This is a temporary debugging commit to diagnose the package matching issue.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-01-15 13:29:23 +05:30
parent 0a4d6cf3ea
commit 2eca36bf66
1 changed files with 19 additions and 3 deletions

View File

@ -87,11 +87,27 @@ export const downloadJamTrack = createAsyncThunk(
throw new Error(`Mixdown "${mixdown.name}" has no packages available`);
}
// Debug: Log package structure to understand field names
console.log('[JamTrack] Available packages for mixdown:', mixdown.name);
console.log('[JamTrack] Looking for: file_type=ogg, encrypt_type=jkz, sample_rate=', sampleRate);
mixdown.packages.forEach((pkg, idx) => {
console.log(`[JamTrack] Package ${idx}:`, {
id: pkg.id,
file_type: pkg.file_type,
fileType: pkg.fileType,
encrypt_type: pkg.encrypt_type,
encryptType: pkg.encryptType,
sample_rate: pkg.sample_rate,
sampleRate: pkg.sampleRate
});
});
// pickMyPackage logic: find compatible package (ogg, jkz, matching sample rate)
// Try both snake_case and camelCase field names
const compatiblePackage = mixdown.packages.find(pkg =>
pkg.file_type === 'ogg' &&
pkg.encrypt_type === 'jkz' &&
pkg.sample_rate === sampleRate
(pkg.file_type === 'ogg' || pkg.fileType === 'ogg') &&
(pkg.encrypt_type === 'jkz' || pkg.encryptType === 'jkz') &&
(pkg.sample_rate === sampleRate || pkg.sampleRate === sampleRate)
);
if (!compatiblePackage) {