Compare commits

..

No commits in common. "0be87c47008ead4aaf253569de1582774cde3870" and "ea505e04741621ebf4a7f77c4b350ad340c309c4" have entirely different histories.

View File

@ -78,12 +78,11 @@ class SpotifyDownloader extends Downloader
const [ , id ] = match; const [ , id ] = match;
if (!id) if (!id)
throw new Error('Could not parse ID from url'); throw new Error('Could not parse ID from url');
this.logger.debug('Song ID', id); this.logger.debug('Song ID', id);
const existing = this.#getSongData(id); const existing = this.#getSongData(id);
if (existing) if (existing)
{ {
this.logger.debug('Found existing entry for', id);
const { artist, song, ext, album } = existing; const { artist, song, ext, album } = existing;
return Promise.resolve({ return Promise.resolve({
existing: true, existing: true,
@ -143,9 +142,9 @@ class SpotifyDownloader extends Downloader
this.#processing = false; 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 } = 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}`);
data = this.#parseFilename(file); data = this.#parseFilename(file);
fs.appendFileSync(path.join(this.downloadDir!, '.song_ids'), `${id}\t${(new Date()).toLocaleString('sv')}\t${data.artist}\t${data.song}\t${file}\n`);
} }
if (!data) if (!data)
return reject(new Error('Failed to find file reference')); return reject(new Error('Failed to find file reference'));