当前位置: 首页>>代码示例>>Python>>正文


Python DatabaseManager.retrieve_derived_performances方法代码示例

本文整理汇总了Python中database.DatabaseManager.retrieve_derived_performances方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseManager.retrieve_derived_performances方法的具体用法?Python DatabaseManager.retrieve_derived_performances怎么用?Python DatabaseManager.retrieve_derived_performances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在database.DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager.retrieve_derived_performances方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: citation_page

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_derived_performances [as 别名]
def citation_page(uuid):
    game_ref = dbm.retrieve_game_ref(uuid)
    perf_ref = dbm.retrieve_perf_ref(uuid)
    derived_performances = dbm.retrieve_derived_performances(uuid)
    previous_performances = dbm.retrieve_performance_chain(uuid)[:-1]
    save_states = dbm.retrieve_save_state(game_uuid=uuid)
    extra_files = dbm.retrieve_file_path(game_uuid=uuid)

    if game_ref:
        return render_template('citation.html',
                               citeref=game_ref,
                               is_game=True,
                               is_performance=False,
                               derived_performances=derived_performances,
                               extra_files=extra_files,
                               save_states=save_states)
    elif perf_ref:
        performance_video = "/cite_data/{}/{}".format(perf_ref['replay_source_file_ref'],
                                                      perf_ref['replay_source_file_name'])
        return render_template('citation.html',
                               citeref=perf_ref,
                               is_game=False,
                               is_performance=True,
                               previous_performances=previous_performances,
                               performance_video=performance_video)
    return "No record found, sorry."
开发者ID:gamecip,项目名称:citetool-editor,代码行数:28,代码来源:app.py

示例2: performance_info

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_derived_performances [as 别名]
def performance_info(uuid):
    perf_info = {}
    perf_ref = dbm.retrieve_perf_ref(uuid)
    perf_info['record'] = perf_ref.elements
    perf_info['linkedStates'] = dbm.retrieve_all_state_perf_links(uuid)
    perf_info['availablePerformances'] = [dict(p.get_element_items()) for p in dbm.retrieve_derived_performances(perf_ref['game_uuid'])]
    return jsonify(perf_info)
开发者ID:gamecip,项目名称:citetool-editor,代码行数:9,代码来源:app.py

示例3: emulation_info_game

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_derived_performances [as 别名]
def emulation_info_game(uuid):
    game_info = {}
    game_ref = dbm.retrieve_game_ref(uuid)
    game_extra_files = dbm.retrieve_file_path(game_uuid=uuid, save_state_uuid=None)

    if game_ref and (game_ref['data_image_source'] or game_extra_files):
        gis = game_ref['data_image_source']
        gsd = game_ref['source_data']
        main_exec = dbm.retrieve_file_path(game_uuid=uuid, save_state_uuid=None, main_executable=True)
        main_fp = main_exec[0]['file_path'].split('/')[-1] if main_exec else None
        game_info['gameFileURL'] = os.path.join('/game_data', gsd, gis) if gis else main_fp
        if game_extra_files:
            game_info['fileMapping'] = {k: os.path.join('/game_data', v, k.split('/')[-1]) for k, v in map(lambda x: (x['file_path'], x['source_data']),
                                                                                     game_extra_files)}
            game_info['fileInformation'] = {f['file_path']: f for f in game_extra_files}
        game_info['stateFileURL'] = None
        game_info['record'] = game_ref.elements
        game_info['availableStates'] = filter(lambda s: True if s.get('save_state_source_data') or s.get('rl_starts_data') else False, dbm.retrieve_save_state(game_uuid=uuid))
        game_info['availablePerformances'] = [dict(p.get_element_items()) for p in dbm.retrieve_derived_performances(uuid)]
    return jsonify(game_info)
开发者ID:gamecip,项目名称:citetool-editor,代码行数:22,代码来源:app.py

示例4: delete

# 需要导入模块: from database import DatabaseManager [as 别名]
# 或者: from database.DatabaseManager import retrieve_derived_performances [as 别名]
def delete(ctx, uuid, keep_performances):
    no_prompts = ctx.obj['NO_PROMPTS']
    verbose = ctx.obj['VERBOSE']

    def check_delete(path):
        try:
            shutil.rmtree(path)
        except OSError as e:
            print e.message

    def delete_from_fts(uuid):
        ix = open_dir(LOCAL_FTS_INDEX)
        writer = ix.writer()
        writer.delete_by_term('id', uuid)
        writer.commit()

    game_ref = dbm.retrieve_game_ref(uuid)
    perf_ref = dbm.retrieve_perf_ref(uuid)
    state_ref = dbm.retrieve_save_state(uuid=uuid)
    if game_ref:
        perfs = dbm.retrieve_derived_performances(uuid)
        states = dbm.retrieve_save_state(game_uuid=uuid)
        files = dbm.retrieve_file_path(game_uuid=uuid)

        for f in files:
                check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_GAME_DATA_STORE, f['source_data']))
        dbm.delete_from_table(dbm.GAME_FILE_PATH_TABLE, ['game_uuid'], [uuid])

        for s in states:
            if s['save_state_source_data']:
                check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, s['save_state_source_data']))
            else:
                if s['rl_starts_data']:
                    check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, s['rl_starts_data']))
                    check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, s['rl_lengths_data']))
            if s['has_screen']:
                check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, s['uuid']))
        dbm.delete_from_table(dbm.GAME_SAVE_TABLE, ['game_uuid'], [uuid])

        for p in perfs:
            if p['replay_source_file_ref']:
                check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, p['replay_source_file_ref']))
            dbm.delete_from_table(dbm.SAVE_STATE_PERFORMANCE_LINK_TABLE,['performance_uuid'], [p['uuid']])
        dbm.delete_from_table(dbm.PERFORMANCE_CITATION_TABLE, ['game_uuid'], [uuid])

        if game_ref['source_data']:
            check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_GAME_DATA_STORE, game_ref['source_data']))

        dbm.delete_from_table(dbm.GAME_CITATION_TABLE, ['uuid'], [uuid])
        delete_from_fts(uuid)
    elif perf_ref:
        dbm.delete_from_table(dbm.SAVE_STATE_PERFORMANCE_LINK_TABLE,['performance_uuid'], [uuid])
        if perf_ref['replay_source_file_ref']:
            check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, perf_ref['replay_source_file_ref']))
        dbm.delete_from_table(dbm.PERFORMANCE_CITATION_TABLE, ['uuid'], [uuid])
        delete_from_fts(uuid)
    elif state_ref:
        state_ref = state_ref[0] # retrieve states returns lists
        files = dbm.retrieve_file_path(save_state_uuid=uuid)
        for f in files:
            check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_GAME_DATA_STORE, f['source_data']))
        dbm.delete_from_table(dbm.SAVE_STATE_PERFORMANCE_LINK_TABLE,['save_state_uuid'], [uuid])
        if state_ref['has_screen']:
            check_delete(os.path.join(LOCAL_DATA_ROOT, LOCAL_CITATION_DATA_STORE, state_ref['uuid']))
        dbm.delete_from_table(dbm.GAME_SAVE_TABLE, ['uuid'], [uuid])
        delete_from_fts(uuid)
    else:
        click.echo('UUID {} not found.'.format(uuid))
        sys.exit(1)
开发者ID:gamecip,项目名称:citetool-editor,代码行数:71,代码来源:citetool_editor.py


注:本文中的database.DatabaseManager.retrieve_derived_performances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。