예제 #1
0
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()
예제 #2
0
def boo(message, sender):
    try:
        if party.setBoo(sender):
            static.booCount += 1
            song = speakermanager.getTrackInfo()
            if static.booCount > party.getNumPlayers() / 2:
                sendtext(sender, config['DEFAULT']['ai_name'] + ": " + song[0] + " by " + song[1] + " has been booed")
                static.booCount = 0
                speakermanager.skip()
            else:
                sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "You already booed " + song[0] + " by " + song[1] + "." " BE NICE.")
     
        sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "You sent a boo command for " + song[0] + " by " + song[1] + ".")
    except:
        sendtext(sender, config['DEFAULT']['ai_name'] + ": " + "There's no song to boo!")
예제 #3
0
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()