AttributeError: 'NoneType' object has no attribute 'split'
Closed this issue · 13 comments
It's failing to find an artist name for that track's album. What's the spotify id for the track that's failing? If you paste the spotify id of the album that the failing track belongs to here and look at the json, you should be able to see why album['artists'][0]['name']
is returning None
i made a really crude fix using the beloved and all hated GPT. i think it was a local file that i favorited so i can get it on my liked songs, (on my phone)
although its a bit... messy... and there's no end either, but it did the job!
Hi!
I just used the project for the first time, and received the same error, for a different reason. In my case, it is because I have some playlists of podcast episodes, which ultimately send a NoneType
object into simple(spotify_track['album']['artists'][0]['name'])
.
I'm not a developer at all, so I may be mistaken, but it seems like a very simple solution would be to add if spotify_track['album']['artists'][0]['name'] is None: continue
into get_new_spotify_tracks()
, or rather change if not spotify_track['id']: continue
to if not spotify_track['id'] or (spotify_track['album']['artists'][0]['name'] is None): continue
.
(To test for show
more explicitly you'd have to search the href
/uri
/external_urls
etc for the term show
or shows
it looks like--the 'type'
field seems to actually display the podcast channel name, not an actual type indicator.)
Of course, I'm sure there are also more advanced functionalities that could be added, like auto-skipping playlists that only contain episodes, and also handling other Spotify track types that aren't songs (if there are any--videos, audiobooks, maybe?), but this change is just one line (I think) and I'm sure those other features aren't particularly important to a lot of people. You can always put your episode playlists in the exclusions after all.
Thank you for the tool!
Hey, yep, works. Still creates the episode playlists, but doesn't try to copy any episodes over. (I'm not sure if spotify allows you to mix music and episodes in playlists or not, never tried.)
OK have released version 1.0.2 that should fix this issue also, lmk if any issues 👍
Is it failing on a podcast or something different? Are you running the latest version?
Running the latest version, and yes it's failing on a podcast.
This one to be exact: https://open.spotify.com/episode/2bZEN988MfsVVkiWMcZqnQ?si=649a70ddad9d47d5
Ah I didn't create a new release yet. You should use the latest commit on main
instead of the release version
Actually looks like I did create a release 1.0.2 with the patch, so probably the patch isn't working. I'll take a look tomorrow
Try v1.0.3