NBS-LLC / ng-spotify-importer

Import playlists into Spotify.
https://nickwanders.com/projects/ng-spotify-importer/
GNU General Public License v3.0
100 stars 17 forks source link

Specific song is not found #217

Closed NBS-LLC closed 1 year ago

NBS-LLC commented 1 year ago

Title: Que Sera Artist: Wax Tailor

More details in the original post.

greenythebeast commented 1 year ago

Another example for you:

Title: Hearts on Fire Artist: ILLENIUM, Dabin, Lights

If I use your tool to search for Hearts on Fire by ILLENIUM or Dabin, nothing comes up. However, if I search for Hearts on Fire by Lights, it does show up. So it seems the tool is struggling when there are more than one artist?

NBS-LLC commented 1 year ago

I cannot reproduce the original issue (see 1st track in the screenshot):

image

But as @greenythebeast points out, songs with multiple artists are not found (see 2nd track in the screenshot).

The issue seems related to the commas used in the artist field. I noticed when double quotes are used the song is found:

image

NBS-LLC commented 1 year ago

Turns out this was a simple bug in how this project uses Spotify's API. It was wrapping the song title and artist name in double quotes. Probably with the intention of ensuring spaces are handled properly. The Spotify API already handles spaces by URI encoding, so quotes are not needed. When the quotes are removed it allows Spotify's search algorithm to do a more relaxed search resulting in better matches.

In my above observation, adding another set of double quotes cancels out the already existing (not shown in the UI) double quotes. Again allowing for a more relaxed search and thus matching the intended song.