- Add S3Service for file operations with MinIO/AWS S3 support - Add AudioMetadataService for metadata extraction - Add MusicFile model with MongoDB integration - Add music API routes for upload, streaming, and management - Add MusicUpload component with drag-and-drop functionality - Add MusicPlayer component with custom audio controls - Add MusicStorage page with complete music management interface - Update Docker Compose with MinIO service - Add comprehensive documentation and testing utilities Features: - S3-compatible storage (MinIO for local, AWS S3 for production) - Audio file upload with metadata extraction - Browser-based music streaming and playback - File management (upload, delete, search, filter) - Integration with existing Rekordbox functionality - Security features (file validation, presigned URLs) - Performance optimizations (indexing, pagination) Supported formats: MP3, WAV, FLAC, AAC, OGG, WMA, Opus
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
import { S3Service } from './src/services/s3Service.js';
|
|
import { AudioMetadataService } from './src/services/audioMetadataService.js';
|
|
|
|
// Test S3 service configuration
|
|
const s3Service = new S3Service({
|
|
endpoint: 'http://localhost:9000',
|
|
accessKeyId: 'minioadmin',
|
|
secretAccessKey: 'minioadmin',
|
|
bucketName: 'music-files',
|
|
region: 'us-east-1',
|
|
});
|
|
|
|
const audioMetadataService = new AudioMetadataService();
|
|
|
|
async function testS3Connection() {
|
|
try {
|
|
console.log('🧪 Testing S3/MinIO connection...');
|
|
|
|
// Test if bucket exists
|
|
const exists = await s3Service.fileExists('test.txt');
|
|
console.log('✅ S3 service initialized successfully');
|
|
|
|
// Test audio file validation
|
|
const isValidAudio = audioMetadataService.isAudioFile('test.mp3');
|
|
console.log('✅ Audio validation working:', isValidAudio);
|
|
|
|
// Test file size formatting
|
|
const formattedSize = audioMetadataService.formatFileSize(5242880);
|
|
console.log('✅ File size formatting:', formattedSize);
|
|
|
|
// Test duration formatting
|
|
const formattedDuration = audioMetadataService.formatDuration(125.5);
|
|
console.log('✅ Duration formatting:', formattedDuration);
|
|
|
|
console.log('\n🎉 All tests passed! S3 storage is ready to use.');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Test failed:', error.message);
|
|
console.log('\n💡 Make sure MinIO is running:');
|
|
console.log(' docker-compose -f docker-compose.dev.yml up -d');
|
|
}
|
|
}
|
|
|
|
testS3Connection();
|