song = self.db.getSong(job.message) if not song: # make sure the artist is in the database artistid = self.db.validateArtist(job.tag['artist']) # add the song self.db.addSong(artistid, job.tag['title'], job.tag['length'], job.message) songid = self.db.getSongId(job.message) else: # check if the values stored for the song are updated songid = song[0] artist = song[1] title = song[2] length = song[3] if artist != job.tag['artist']: self.db.updateArtist(songid, job.tag['artist']) if title != job.tag['title']: self.db.update(songid, "title", job.tag['title']) if length != job.tag['length']: self.db.update(songid, "length", job.tag['length']) self.db.addPlaylist(job.getTimestamp("%Y-%m-%d %H:%M:%S"), songid)