def like(message, sender): try: song = speakermanager.getTrackInfo() hash = hashlib.md5((song[0] + song[2]).encode("UTF-8")).hexdigest() global curhash if curhash != hash: curhash = hash phones.clear() if sender not in phones: phones.append(sender) if hash not in hottrack: hottrack[hash] = [song[0], song[2], 0] hottrack[hash][2] += 1 sendtext( sender, config['DEFAULT']['ai_name'] + ": " + "You liked " + song[0] + " by " + song[1] + " song!") savesongs() if hottrack[hash][2] > party.getNumPlayers() / 2: speakermanager.playSong( (speakermanager.curSource, song[0], song[2])) else: sendtext( sender, config['DEFAULT']['ai_name'] + ": " + "You already liked " + song[0] + " by " + song[1] + " song!") except: sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "No song is playing :(") traceback.print_exc()
def playNextSong(): """ ~ Plays the next song ~ Plays the next song queued and clears the boo array and alerts the player who queued the song that his/her song will be played next """ speakermanager.playSong(getNextSong()) clearBoos() time.sleep(5) ns = acquireNextSong() if ns: sendtext(ns[0], config['DEFAULT']['ai_name'] + ": " +"Your song '" + ns[1][0] + "' will be playing next!")
def playNextSong(): """ ~ Plays the next song ~ Plays the next song queued and clears the boo array and alerts the player who queued the song that his/her song will be played next """ speakermanager.playSong(getNextSong()) clearBoos() time.sleep(5) ns = acquireNextSong() if ns: sendtext(ns[0], config["DEFAULT"]["ai_name"] + ": " + "Your song '" + ns[1][0] + "' will be playing next!")
def like(message, sender): try: song = speakermanager.getTrackInfo() hash = hashlib.md5((song[0] + song[2]).encode("UTF-8")).hexdigest() global curhash if curhash != hash: curhash = hash phones.clear() if sender not in phones: phones.append(sender) if hash not in hottrack: hottrack[hash] = [song[0], song[2], 0] hottrack[hash][2] += 1 sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "You liked " + song[0] + " by " + song[1] + " song!") savesongs() if hottrack[hash][2] > party.getNumPlayers() / 2: speakermanager.playSong((speakermanager.curSource, song[0], song[2])) else: sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "You already liked " + song[0] + " by " + song[1] + " song!") except: sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "No song is playing :(") traceback.print_exc()