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)
|
#parseFilename (fileName: string)
|
||||||
{
|
{
|
||||||
const [ name, ext ] = fileName.split('.');
|
const match = fileName.match(/(?<artist>.+)\W---\W(?<song>.+)\W---\W(?<album>.+)(?<ext>\.\w+)$/u);
|
||||||
const [ artist, song, album ] = name.split('---').map(str => str.trim());
|
if (!match || !match.groups)
|
||||||
|
throw new Error('Unknown file name format');
|
||||||
|
|
||||||
|
const { artist, song, album, ext } = match.groups;
|
||||||
return {
|
return {
|
||||||
fileName,
|
fileName,
|
||||||
artist,
|
artist,
|
||||||
|
Loading…
Reference in New Issue
Block a user