Auto-create audio_library folder and improve scanner error handling
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user