Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local files causing error #196

Merged
merged 2 commits into from Oct 25, 2021
Merged

Conversation

tonyd33
Copy link
Contributor

@tonyd33 tonyd33 commented Jul 18, 2021

Seems like #181 fixes the TypeError that was originally reported in #167, but it didn't solve the fact that local files still caused an error. Upon further inspection, since an artist from a local file had a uri of None, and that was being passed into sp.artist, that was still causing an error. Additionally, it could be possible that there are no artists associated, which would cause an IndexError.

I added checks to ensure

  • There is at least one artist before trying to get their uri
  • The artist had a non-None uri before passing it into sp.artist

Also, added a test for the local files case. It doesn't cover the case where the artist though. Additionally, I'm sourcing the playlist from one I created, which I could forget about and delete in the future, so I recommend creating your own playlist with songs from local files with an artist, and without an artist and replacing it in the test.

fixes #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError if local song in playlist
2 participants