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()
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()
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()
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)
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)
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))
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))