PythonistaGuild / Wavelink

A powerful Lavalink library for Discord.py.
https://wavelink.dev
MIT License
389 stars 179 forks source link

Spotify Extension Fixes (Album/ISRC and minor issues) #222

Closed aukur closed 1 year ago

aukur commented 1 year ago

When requesting albums, the Spotify API only returns SimplifiedTrackObjects that do not contain all the track information received when requesting tracks or playlists. #197 attempted to resolved this by making the ISRC optional on SpotifyTracks. However, Wavelink uses the ISRC of SpotifyTracks in their fulfill function.

 try:
            tracks: list[cls] = await cls.search(f'"{self.isrc}"')
        except wavelink.NoTracksError:
            tracks: list[cls] = await cls.search(f'{self.name} - {self.artists[0]}')

In both #219 and my own observations these missing ISRC have resulted in the incorrect song to be repeatedly found. This PR would resolve the SimplifiedTrackObjects into full ones, preventing this issue, as well as end #209.

Additional it resolves the issue discussed in #221 without any breaking changes to those not using return_first. (On this change feel free to correct me if the instance check against SpotifyTrack is too narrow).

Finally, it would correct the minor error causing playlist searches to error when not using the iterator.

EvieePy commented 1 year ago

Thanks for the PR. Appreciate you working through this.

EvieePy commented 1 year ago

Fixes #212, fixes #209