platers / unitunes

A GUI and library to transfer, sync, and backup playlists on music streaming services
GNU General Public License v3.0
129 stars 12 forks source link

fix spotify search? #15

Closed johan12345 closed 1 year ago

johan12345 commented 1 year ago

I am currently trying to copy a playlist from Youtube Music to Spotify and getting no matches for any track in that playlist, even though I know that they exist on Spotify. I noticed that the Spotify search query always includes a formatted output for the AliasedString object such as track:"value='Some song' aliases=[]" instead of just the track name 'Some Song (track.name.value). Does the Spotify API actually support this pattern? I couldn't find any example of this in the docs. If I try to just pass track.name.value, as implemented in this PR, I get at least 2 matches for my playlist.

I also noticed that Spotify seems to be very picky about search queries - if a track has multiple artists listed on Spotify, but we only know one of them from YTM, Spotify cannot find it. So maybe the query generator should also generate a query that omits the artist as a fallback?

platers commented 1 year ago

Thanks for the fix! The tests for searching need great improvement. Thats a good idea on omitting the artist. Theres a lot of low hanging fruit in optimizing the searching. I haven't done much work there because there isn't a principled way to evaluate search yet. I'm happy to take PR's that improve search performance on your tracks for now.