allow processing to resume when rejecting
This commit is contained in:
parent
6efdbd88ea
commit
a79d14bf3f
@ -119,7 +119,10 @@ class SpotifyDownloader extends Downloader
|
|||||||
childProcess.exec(`"${this.#executable}" --root-path "${this.downloadDir}" ${this.#options.join(' ')} ${url}`, (error, stdout, stderr) =>
|
childProcess.exec(`"${this.#executable}" --root-path "${this.downloadDir}" ${this.#options.join(' ')} ${url}`, (error, stdout, stderr) =>
|
||||||
{
|
{
|
||||||
if (error)
|
if (error)
|
||||||
|
{
|
||||||
|
this.#processing = false;
|
||||||
return reject(error);
|
return reject(error);
|
||||||
|
}
|
||||||
|
|
||||||
if (stderr && !stderr.includes('###'))
|
if (stderr && !stderr.includes('###'))
|
||||||
this.logger.debug('stderr', stderr);
|
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');
|
this.logger.debug('Got ID mismatch, attempting to parse stdout to find filename');
|
||||||
const match = stdout.match(reg);
|
const match = stdout.match(reg);
|
||||||
if (!match)
|
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'));
|
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!;
|
const { file, name } = match.groups!;
|
||||||
fs.appendFileSync(path.join(this.downloadDir!, '.song_ids'), `${id}\t${(new Date()).toLocaleString('sv')}\t${name}\t${file}`);
|
fs.appendFileSync(path.join(this.downloadDir!, '.song_ids'), `${id}\t${(new Date()).toLocaleString('sv')}\t${name}\t${file}`);
|
||||||
data = this.#parseFilename(file);
|
data = this.#parseFilename(file);
|
||||||
}
|
}
|
||||||
if (!data)
|
if (!data)
|
||||||
|
{
|
||||||
|
this.#processing = false;
|
||||||
return reject(new Error('Failed to find file reference'));
|
return reject(new Error('Failed to find file reference'));
|
||||||
|
}
|
||||||
|
|
||||||
const { fileName, artist, song, album, ext } = data;
|
const { fileName, artist, song, album, ext } = data;
|
||||||
const filePath = path.join(this.downloadDir!, fileName);
|
const filePath = path.join(this.downloadDir!, fileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user