Hi, I am trying to write a python script that will tweet the name and artist of a song when it plays. I have achieved this but the problem I have is when the player stops or I pause or forward the song the script crashes.
My code so far is
lastSong = None
currentSong = client.currentsong()
if currentSong != lastSong:
api.update_status(status= currentSong['artist'] + " - " + currentSong['title'] + "\n" + "#NowPlaying" + " #" + currentSong['artist'].translate(None, whitespace))
lastSong = currentSong
time.sleep(59) #change this to however often you wanna poll.