示例#1
0
文件: eqbot.py 项目: codl/eqbot
def newTracks(bot):
    for t in eqbeats.newTracks():
        for c in bot.channels:
            if c.level >= 90:
                bot.sendMsg(c.name, "New track: " + eqbeats.ppTrack(t))
        bot.lastTid = str(t['id'])
    return 120
示例#2
0
文件: eqbot.py 项目: codl/eqbot
def ffeature(e, bot):
    if auth(e.source) >= HOP:
        tids = e.args
        if len(tids) == 0 and bot.lastTid:
            tids = (bot.lastTid,)
        with open("/var/spool/eqbeats/feature.queue", "a") as f:
            for tid in tids:
                t = eqbeats.track(tid)
                if(t):
                    f.write("%d %s - %s\n" % (t['id'], t['artist']['name'], t['title']))
                    e.reply("queued %s forcefully\n" % (eqbeats.ppTrack(t)))
示例#3
0
文件: eqbot.py 项目: codl/eqbot
def _search(e, bot, q):
    try:
        id = int(q)
        t = eqbeats.track(id)
        if t:
            e.reply(eqbeats.ppTrack(t))
            bot.lastTid = str(id)
            return
        else:
            e.reply("No tracks found.")
    except ValueError:
        if not q == "":
            tracks = eqbeats.search(q)[:3]
            for t in tracks[:2]:
                bot.reply(e, eqbeats.ppTrack(t))
            if len(tracks) == 0:
                bot.reply(e, "No tracks found.")
            elif len(tracks) == 1:
                bot.lastTid = str(tracks[0]['id'])
            elif len(tracks) == 3:
                bot.reply(e, "and more at https://eqbeats.org/tracks/search?%s" % up.urlencode({'q': q}))
示例#4
0
文件: eqbot.py 项目: codl/eqbot
def rand_track(e, bot):
    bot.reply(e, eqbeats.ppTrack(eqbeats.random()))