Ejemplo n.º 1
0
        osuDBfp = sys.argv[1]

    if len(sys.argv) > 2:
        collectionDBfp = sys.argv[2]

    if len(sys.argv) > 3:
        scoresDBfp = sys.argv[3]

    COLLECTIONS_FP = collectionDBfp

    osuDb = open(osuDBfp, 'rb')
    collectionsDb = open(collectionDBfp, 'rb')
    scoresDb = open(scoresDBfp, 'rb')

    collections = dbparse.parseCollectionsDb(collectionsDb.read())
    beatmaps = dbparse.parseOsuDb(osuDb.read())
    scores = dbparse.parseScoresDb(scoresDb.read())

    # transform scores to be slightly easier to work with
    scores = {bm['file_md5']: bm for bm in scores['beatmaps']}

    # add some extra fields to the beatmaps dictionary
    for md5 in beatmaps['beatmaps']:
        if md5 not in scores:
            beatmaps['beatmaps'][md5]['top_rank'] = 'F'
            beatmaps['beatmaps'][md5]['top_combo'] = 0
            beatmaps['beatmaps'][md5]['top_accuracy'] = 0
            beatmaps['beatmaps'][md5]['passes'] = 0
            continue

        sortedScores = sorted(scores[md5]['scores'], key=lambda s: -s['score'])
Ejemplo n.º 2
0
import dbparse
import json

scoredb = dbparse.parseScoresDb(open('data/scores.db').read())
beatmapdb = dbparse.parseOsuDb(open('data/osu!.db').read())

for beatmap in scoredb['beatmaps']:
    if beatmap['file_md5'] not in beatmapdb['beatmaps']:
        print beatmap['file_md5'] + ' not in local beatmaps'
        continue
    db = beatmapdb['beatmaps'][beatmap['file_md5']]
    for key in db:
        beatmap[key] = db[key]

json.dump(scoredb, open('data/scores_aug.json', 'w'), indent=4)
Ejemplo n.º 3
0
        osuDBfp = sys.argv[1]

    if len(sys.argv) > 2:
        collectionDBfp = sys.argv[2]

    if len(sys.argv) > 3:
        scoresDBfp = sys.argv[3]

    COLLECTIONS_FP = collectionDBfp

    osuDb = open(osuDBfp, 'rb')
    collectionsDb = open(collectionDBfp, 'rb')
    scoresDb = open(scoresDBfp, 'rb')

    collections = dbparse.parseCollectionsDb(collectionsDb.read())
    beatmaps = dbparse.parseOsuDb(osuDb.read())
    scores = dbparse.parseScoresDb(scoresDb.read())

    # transform scores to be slightly easier to work with
    scores = {bm['file_md5']: bm for bm in scores['beatmaps']}

    # add some extra fields to the beatmaps dictionary
    for md5 in beatmaps['beatmaps']:
        if md5 not in scores:
            beatmaps['beatmaps'][md5]['top_rank'] = 'F'
            beatmaps['beatmaps'][md5]['top_combo'] = 0
            beatmaps['beatmaps'][md5]['top_accuracy'] = 0
            beatmaps['beatmaps'][md5]['passes'] = 0
            continue

        sortedScores = sorted(scores[md5]['scores'], key=lambda s:-s['score'])