コード例 #1
0
ファイル: cache.py プロジェクト: vangar/bemaniutils
 def preload(cls, data: Data, config: Dict[str, Any]) -> None:
     cache = Cache(app, config={
         'CACHE_TYPE': 'filesystem',
         'CACHE_DIR': config['cache_dir'],
     })
     frontend = IIDXFrontend(data, config, cache)
     frontend.get_all_songs(force_db_load=True)
コード例 #2
0
def viewevents() -> Response:
    iidx = IIDXFrontend(g.data, g.config, g.cache)
    jubeat = JubeatFrontend(g.data, g.config, g.cache)
    pnm = PopnMusicFrontend(g.data, g.config, g.cache)
    return render_react(
        'Events',
        'admin/events.react.js',
        {
            'events': [format_event(event) for event in g.data.local.network.get_events(limit=100)],
            'users': {user.id: user.username for user in g.data.local.user.get_all_users()},
            'arcades': {arcade.id: arcade.name for arcade in g.data.local.machine.get_all_arcades()},
            'iidxsongs': iidx.get_all_songs(),
            'jubeatsongs': jubeat.get_all_songs(),
            'pnmsongs': pnm.get_all_songs(),
            'iidxversions': {version: name for (game, version, name) in iidx.all_games()},
            'jubeatversions': {version: name for (game, version, name) in jubeat.all_games()},
            'pnmversions': {version: name for (game, version, name) in pnm.all_games()},
        },
        {
            'refresh': url_for('admin_pages.listevents', since=-1),
            'backfill': url_for('admin_pages.backfillevents', until=-1),
            'viewuser': url_for('admin_pages.viewuser', userid=-1),
            'jubeatsong': url_for('jubeat_pages.viewtopscores', musicid=-1) if g.config.get('support', {}).get(GameConstants.JUBEAT, False) else None,
            'iidxsong': url_for('iidx_pages.viewtopscores', musicid=-1) if g.config.get('support', {}).get(GameConstants.IIDX, False) else None,
            'pnmsong': url_for('popn_pages.viewtopscores', musicid=-1) if g.config.get('support', {}).get(GameConstants.POPN_MUSIC, False) else None,
        },
    )
コード例 #3
0
def viewscores(userid: UserID) -> Response:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    djinfo = frontend.get_latest_player_info([userid]).get(userid)
    if djinfo is None:
        abort(404)

    scores = frontend.get_scores(userid, limit=100)
    if len(scores) > 10:
        scores = frontend.round_to_ten(scores)

    return render_react(
        f'dj {djinfo["name"]}\'s IIDX Scores',
        'iidx/scores.react.js',
        {
            'attempts': scores,
            'songs': frontend.get_all_songs(),
            'players': {},
            'versions':
            {version: name
             for (game, version, name) in frontend.all_games()},
            'showdjnames': False,
            'shownewrecords': True,
        },
        {
            'refresh': url_for('iidx_pages.listscores', userid=userid),
            'player': url_for('iidx_pages.viewplayer', userid=-1),
            'individual_score': url_for('iidx_pages.viewtopscores',
                                        musicid=-1),
        },
    )
コード例 #4
0
def viewnetworkscores() -> Response:
    # Only load the last 100 results for the initial fetch, so we can render faster
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    network_scores = frontend.get_network_scores(limit=100)
    if len(network_scores['attempts']) > 10:
        network_scores['attempts'] = frontend.round_to_ten(
            network_scores['attempts'])

    return render_react(
        'Global IIDX Scores',
        'iidx/scores.react.js',
        {
            'attempts': network_scores['attempts'],
            'songs': frontend.get_all_songs(),
            'players': network_scores['players'],
            'versions':
            {version: name
             for (game, version, name) in frontend.all_games()},
            'showdjnames': True,
            'shownewrecords': False,
        },
        {
            'refresh': url_for('iidx_pages.listnetworkscores'),
            'player': url_for('iidx_pages.viewplayer', userid=-1),
            'individual_score': url_for('iidx_pages.viewtopscores',
                                        musicid=-1),
        },
    )
コード例 #5
0
def viewrecords(userid: UserID) -> Response:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    djinfo = frontend.get_latest_player_info([userid]).get(userid)
    if djinfo is None:
        abort(404)

    return render_react(
        f'dj {djinfo["name"]}\'s IIDX Records',
        'iidx/records.react.js',
        {
            'records': frontend.get_records(userid),
            'songs': frontend.get_all_songs(),
            'players': {},
            'versions':
            {version: name
             for (game, version, name) in frontend.all_games()},
            'showdjnames': False,
            'showpersonalsort': True,
            'filterempty': True,
        },
        {
            'refresh': url_for('iidx_pages.listrecords', userid=userid),
            'player': url_for('iidx_pages.viewplayer', userid=-1),
            'individual_score': url_for('iidx_pages.viewtopscores',
                                        musicid=-1),
        },
    )
コード例 #6
0
def viewnetworkrecords() -> Response:
    frontend = IIDXFrontend(g.data, g.config, g.cache)
    network_records = frontend.get_network_records()

    return render_react(
        'Global IIDX Records',
        'iidx/records.react.js',
        {
            'records': network_records['records'],
            'songs': frontend.get_all_songs(),
            'players': network_records['players'],
            'versions':
            {version: name
             for (game, version, name) in frontend.all_games()},
            'showdjnames': True,
            'showpersonalsort': False,
            'filterempty': False,
        },
        {
            'refresh': url_for('iidx_pages.listnetworkrecords'),
            'player': url_for('iidx_pages.viewplayer', userid=-1),
            'individual_score': url_for('iidx_pages.viewtopscores',
                                        musicid=-1),
        },
    )