diff --git a/src/client/components/downloaders/Spotify.ts b/src/client/components/downloaders/Spotify.ts index 433ef64..a7b6328 100644 --- a/src/client/components/downloaders/Spotify.ts +++ b/src/client/components/downloaders/Spotify.ts @@ -119,7 +119,10 @@ class SpotifyDownloader extends Downloader childProcess.exec(`"${this.#executable}" --root-path "${this.downloadDir}" ${this.#options.join(' ')} ${url}`, (error, stdout, stderr) => { if (error) + { + this.#processing = false; return reject(error); + } if (stderr && !stderr.includes('###')) this.logger.debug('stderr', stderr); @@ -132,13 +135,19 @@ class SpotifyDownloader extends Downloader this.logger.debug('Got ID mismatch, attempting to parse stdout to find filename'); const match = stdout.match(reg); if (!match) + { + this.#processing = false; return reject(new Error('Got bad output from zotify (could not find file name) and could not find by ID from cache file')); + } const { file, name } = match.groups!; fs.appendFileSync(path.join(this.downloadDir!, '.song_ids'), `${id}\t${(new Date()).toLocaleString('sv')}\t${name}\t${file}`); data = this.#parseFilename(file); } if (!data) + { + this.#processing = false; return reject(new Error('Failed to find file reference')); + } const { fileName, artist, song, album, ext } = data; const filePath = path.join(this.downloadDir!, fileName);