Fixed bug when searching for existing songs whose name contains a period
This commit is contained in:
parent
494862c93f
commit
d6c131fe2e
@ -188,8 +188,11 @@ class SpotifyDownloader extends Downloader
|
||||
|
||||
#parseFilename (fileName: string)
|
||||
{
|
||||
const [ name, ext ] = fileName.split('.');
|
||||
const [ artist, song, album ] = name.split('---').map(str => str.trim());
|
||||
const match = fileName.match(/(?<artist>.+)\W---\W(?<song>.+)\W---\W(?<album>.+)(?<ext>\.\w+)$/u);
|
||||
if (!match || !match.groups)
|
||||
throw new Error('Unknown file name format');
|
||||
|
||||
const { artist, song, album, ext } = match.groups;
|
||||
return {
|
||||
fileName,
|
||||
artist,
|
||||
|
Loading…
Reference in New Issue
Block a user