コード例 #1
0
def main() -> None:
    public_path = ROOT_PATH / Path('public')
    data_path = public_path / 'data'

    past_events = load_json_files(data_path)
    future_events = load_json_files(data_path / 'future')
    events = past_events + future_events

    update_db(events)
コード例 #2
0
ファイル: network.py プロジェクト: psenough/shader_summary
def get_opponent_pairs(path: Path) -> Iterator[tuple[str, str]]:
    handles_db = load_db()

    for data in load_json_files(path):
        for phase in data['phases']:
            entries = phase['entries']
            for a in entries:
                for b in entries:
                    if a != b:
                        handle_a = get_handle(handles_db, a['handle'])
                        handle_b = get_handle(handles_db, b['handle'])
                        if handle_a != handle_b:
                            yield handle_a, handle_b
コード例 #3
0
def main() -> None:
    public_path = ROOT_PATH / Path('public')
    data_path = public_path / 'data'
    media_path = public_path / 'media'

    events = load_json_files(data_path)

    for event in events:
        try:
            download_shadertoy_overview.create_cache(event, media_path)
            download_tic80_cart_overview.create_cache(event, media_path)
        except Exception as err:
            print("Unexpected error: {0} processing {1}".format(
                err, event['title']))
コード例 #4
0
def load_future_events(data_path: Path):
    events = load_json_files(data_path / 'future')
    events = presort_events(events)
    return sorted(events, key=lambda e: e['started'], reverse=False)
コード例 #5
0
def load_past_events(data_path: Path):
    events = load_json_files(data_path)
    events = presort_events(events)
    return sorted(events, key=lambda e: e['started'], reverse=True)