コード例 #1
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)))
コード例 #2
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}))