コード例 #1
0
ファイル: parselogs.py プロジェクト: laudiacay/cslbot
def main(config, outdir):
    session = get_session(config)
    # FIXME: this only has second percision, so it's possible that events with the same timestamp might be dropped.
    timestamp = get_timestamp(config, outdir)
    for row in session.query(Log).filter(Log.time > timestamp).order_by(Log.time).all():
        check_day(row, outdir, config['core']['channel'])
        write_log(row.target, outdir, gen_log(row))
    for x in logs.values():
        x.close()
コード例 #2
0
ファイル: parselogs.py プロジェクト: bobtwinkles/cslbot
def main(cfg, outdir):
    session = get_session(cfg)()
    current_id = get_id(outdir)
    new_id = session.query(Log.id).order_by(Log.id.desc()).limit(1).scalar()
    save_id(outdir, new_id)
    for row in session.query(Log).filter(new_id >= Log.id).filter(Log.id > current_id).order_by(Log.id).all():
        check_day(row, outdir, cfg['core']['channel'])
        write_log(row.target, outdir, gen_log(row))
    for x in logs.values():
        x.close()
コード例 #3
0
ファイル: parselogs.py プロジェクト: jwoglom/ionbot
def main(config, outdir):
    session = get_session(config)()
    current_id = get_id(config, outdir)
    new_id = session.query(Log.id).order_by(Log.id.desc()).limit(1).scalar()
    save_id(outdir, new_id)
    for row in session.query(Log).filter(new_id >= Log.id).filter(
            Log.id > current_id).order_by(Log.id).all():
        check_day(row, outdir, config['core']['channel'])
        write_log(row.target, outdir, gen_log(row))
    for x in logs.values():
        x.close()
コード例 #4
0
ファイル: parsedata.py プロジェクト: jwoglom/ionbot
def main(config, outdir):
    session = get_session(config)()
    env = Environment(loader=FileSystemLoader(dirname(__file__) + '/../static/templates'))
    time = strftime('Last Updated at %I:%M %p on %a, %b %d, %Y')

    if not exists(outdir):
        mkdir(outdir)

    output_quotes(env, session, outdir, time)
    output_scores(env, session, outdir, time)
    output_polls(env, session, outdir, time)
    output_urls(env, session, outdir, time)
コード例 #5
0
ファイル: parsedata.py プロジェクト: theycallmezeal/cslbot
def main(config, outdir):
    session = get_session(config)
    env = Environment(loader=FileSystemLoader(dirname(__file__)+'/../static/templates'))
    time = strftime('Last Updated at %I:%M %p on %a, %b %d, %Y')

    if not exists(outdir):
        mkdir(outdir)

    output_quotes(env, session, outdir, time)
    output_scores(env, session, outdir, time)
    output_polls(env, session, outdir, time)
    output_urls(env, session, outdir, time)
コード例 #6
0
ファイル: gen_babble.py プロジェクト: jwoglom/ionbot
def main(config, speaker):
    session = get_session(config)()
    cmdchar = config['core']['cmdchar']
    ctrlchan = config['core']['ctrlchan']
    print('Generating markov.')
    # FIXME: support locking for other dialects?
    if session.bind.dialect.name == 'postgresql':
        session.execute('LOCK TABLE babble IN EXCLUSIVE MODE NOWAIT')
        session.execute('LOCK TABLE babble_count IN EXCLUSIVE MODE NOWAIT')
        session.execute('LOCK TABLE babble_last IN EXCLUSIVE MODE NOWAIT')
    t = time.time()
    build_markov(session, cmdchar, ctrlchan, speaker, initial_run=True, debug=True)
    print('Finished markov in %f' % (time.time() - t))
コード例 #7
0
ファイル: gen_babble.py プロジェクト: jwoglom/ionbot
def main(config, speaker):
    session = get_session(config)()
    cmdchar = config['core']['cmdchar']
    ctrlchan = config['core']['ctrlchan']
    print('Generating markov.')
    # FIXME: support locking for other dialects?
    if session.bind.dialect.name == 'postgresql':
        session.execute('LOCK TABLE babble IN EXCLUSIVE MODE NOWAIT')
        session.execute('LOCK TABLE babble_count IN EXCLUSIVE MODE NOWAIT')
        session.execute('LOCK TABLE babble_last IN EXCLUSIVE MODE NOWAIT')
    t = time.time()
    build_markov(session,
                 cmdchar,
                 ctrlchan,
                 speaker,
                 initial_run=True,
                 debug=True)
    print('Finished markov in %f' % (time.time() - t))
コード例 #8
0
ファイル: parselogs.py プロジェクト: nwatson/cslbot
def main(config, outdir):
    session = get_session(config)
    for row in session.query(Log).order_by(Log.time).all():
        check_day(row, outdir, config['core']['channel'])
        write_log(row.target, outdir, gen_log(row))