diff --git a/src/services/audioScanner.js b/src/services/audioScanner.js index fcfde23..a0e2045 100644 --- a/src/services/audioScanner.js +++ b/src/services/audioScanner.js @@ -13,8 +13,25 @@ export class AudioScanner { async scanLibrary() { console.log(`🔍 Scanning library: ${this.libraryPath}`); + + // Check if directory exists, create if not + try { + await fs.access(this.libraryPath); + } catch (error) { + console.log(`📁 Creating library directory: ${this.libraryPath}`); + await fs.mkdir(this.libraryPath, { recursive: true }); + console.log(`⚠️ Directory was empty. Add audio files to ${this.libraryPath} and scan again.`); + return; + } + const files = await this.findAudioFiles(this.libraryPath); console.log(`📁 Found ${files.length} audio files`); + + if (files.length === 0) { + console.log(`⚠️ No audio files found in ${this.libraryPath}`); + console.log(` Add .mp3, .m4a, .flac, .wav, .aac, or .ogg files and scan again.`); + return; + } let processed = 0; for (const filePath of files) {