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);