예제 #1
0
def update(sr_name):
    # Update past week's threads according to the current template
    r = Reddit('aaf_gamethread')
    ensure_scopes(r)
    gt = AAFGameThread(r, sr_name, ",".join(subreddits.keys()))
    gt.active_buffer = timedelta(days=7)
    active_games = gt.active_games()
    gt.update_existing(active_games)
예제 #2
0
def main():
    import sys
    import time

    r = Reddit('aaf_gamethread')
    ensure_scopes(r)

    gt = AAFGameThread(r, sys.argv[1], ",".join(subreddits.keys()))

    while True:
        gt.get_games()
        active_games = gt.active_games()
        gt.archive_completed(active_games)
        if len(active_games) > 0:
            gt.post_due_threads(active_games)
            gt.update_existing(active_games)
        sleep = gt.decide_sleep(active_games)
        time.sleep(sleep.total_seconds())