Esempio n. 1
0
import bafread

details = bafread.read(['reviews',
                        'persons',
                        'personnames',
                        'game_links',
                        'links'])

nameIDs = {}
names = {}

for someone in details['personnames']:
    name = someone[2]
    if ', ' in name:
        comma = name.find(', ')
        name = name[comma+2:] + ' ' + name[:comma]
    nameIDs[someone[0]] = name

for someone in details['persons']:
    names[someone[0]] = nameIDs[someone[1]]

del nameIDs

game_links = {}
links = {}

for link in details['game_links']:
    (game, linkid) = link

    if not game in game_links:
        game_links[game] = []
Esempio n. 2
0
import bafread

details = bafread.read(['genres'])

result = bafread.writingfile('genres.ini')

names = {}
parents = {}

for detail in details['genres']:
    names[detail[0]] = bafread.normalise(detail[2])
    parents[detail[0]] = detail[1]

for detail in details['genres']:
    genre = 'c'+detail[0]

    cursor = detail[0]
    name = ''
    while cursor:
        name = names[cursor] + ' > ' + name
        cursor = parents[cursor]

    result.write(genre+'.name='+name[:-3]+'\n')
    result.write(genre+'.desc='+bafread.normalise(detail[3])+'\n')


import bafread

details = bafread.read(['genres',
                        'gamegenres',
                        'games',
                        'titles',
                        'reviews'])

game_to_title_id = {}
titles = {}
scores = {}

for game in details['games']:
    game_to_title_id[game[0]] = game[1]

for title in details['titles']:
    titles[title[1]] = title[2]

for score in details['reviews']:
    scores[score[0]] = score[3]

for detail in details['genres']:
    result = bafread.writingfile('c'+detail[0]+'.ini')
    result.write('title='+detail[2]+'\n')

    for game in details['gamegenres']:
        if game[1]==detail[0]:
            gamecode = 's'+game[0]
            if game[0] in scores and scores[game[0]]!=None:
                gamescore = scores[game[0]]
            else: