rekordbox-viewer/packages/backend/test-current-webdav.js
Geert Rademakes 9de7564c18 Fix WebDAV file listing issue and add AIFF support
- Fix WebDAV service to find all 4,101 MP3 files instead of 1,023
- Add support for AIFF files (.aif, .aiff) in audio detection
- Update audioMetadataService to recognize AIFF formats
- Simplify BackgroundJobProgress component polling logic
- Add maxDepth parameter to WebDAV directory listing
- Add comprehensive test scripts for debugging WebDAV integration

The WebDAV integration now correctly processes all 4,257 audio files
from the music collection, including 4,101 MP3 files and 156 other
audio formats (FLAC, WAV, AIFF, M4A, OGG).
2025-09-17 22:52:15 +02:00

52 lines
1.7 KiB
JavaScript

import { StorageProviderFactory } from './dist/services/storageProvider.js';
async function testCurrentWebDAV() {
try {
console.log('🔍 Testing Current WebDAV Service:');
console.log('');
// Load config and create provider (same as background job)
const config = await StorageProviderFactory.loadConfig();
console.log('Config provider:', config.provider);
console.log('Config basePath:', config.basePath);
console.log('');
// Create storage service
const storageService = await StorageProviderFactory.createProvider(config);
console.log('Storage service created:', storageService.constructor.name);
console.log('');
// List all files
console.log('📁 Listing all files...');
const startTime = Date.now();
const storageFiles = await storageService.listAllFiles();
const endTime = Date.now();
console.log(`✅ listAllFiles completed in ${endTime - startTime}ms`);
console.log('Total storage files found:', storageFiles.length);
console.log('');
// Filter for MP3 files
const mp3Files = storageFiles.filter(file => {
const filename = file.key.split('/').pop() || file.key;
return filename.toLowerCase().endsWith('.mp3');
});
console.log('🎵 MP3 files found:', mp3Files.length);
console.log('');
// Show first 10 MP3 files
console.log('🎵 First 10 MP3 files:');
mp3Files.slice(0, 10).forEach((file, index) => {
console.log(` ${index + 1}. ${file.key} (${file.size} bytes)`);
});
} catch (error) {
console.error('❌ Failed to test current WebDAV service:', error);
console.error('Error details:', error.message);
console.error('Stack trace:', error.stack);
}
}
// Run the test
testCurrentWebDAV().catch(console.error);