diff --git a/main.ts b/main.ts index 1057cd4..40ca380 100644 --- a/main.ts +++ b/main.ts @@ -227,7 +227,7 @@ class DownloadQueue { while (this.activeDownloads < this.maxConcurrency && this.queue.length > 0) { const { url, folder, filename } = this.queue.shift()!; this.activeDownloads++; - + this.processDownload(url, folder, filename).then(() => { this.activeDownloads--; this.processQueue(); @@ -238,7 +238,7 @@ class DownloadQueue { }); } } - + private async processDownload(url: string, folder: string, filename: string): Promise { await downloadSong(url, folder, filename); songCount++; @@ -261,6 +261,11 @@ for (const mentalState of mentalStates) { authorization: `Bearer ${AUTHTOKEN}` } }); + if (!response.ok) { + chalk.red("ERROR SEARCHING SONGS") + chalk.red(response.text()); + continue; + } const responseData = await response.json(); const data = formatAudioData(responseData.result);