chat archiver: Add cli tool for downloading emotes

pull/318/head
Mike Lang 2 years ago committed by Mike Lang
parent 92b34d2670
commit 3b6ce86c46

@ -0,0 +1,18 @@
import gevent.monkey
gevent.monkey.patch_all()
import argh
import logging
import json
from chat_archiver.main import ensure_emotes, wait_for_ensure_emotes
def main(base_dir, *ids, log='INFO'):
"""Ensure all listed emote ids are downloaded"""
logging.basicConfig(level=log)
ensure_emotes(base_dir, ids)
wait_for_ensure_emotes()
if __name__ == '__main__':
argh.dispatch_command(main)

@ -322,6 +322,10 @@ def ensure_emotes(base_dir, emote_ids):
logging.debug("Skipping checking emote with key {} - already running".format(key))
def wait_for_ensure_emotes():
gevent.wait(_EMOTES_RUNNING.values())
def write_batch(path, batch_time, messages, size_histogram=None):
"""Batches are named PATH/YYYY-MM-DDTHH/MM:SS-HASH.json"""
output = (format_batch(messages) + '\n').encode('utf-8')

Loading…
Cancel
Save