コード例 #1
0
ファイル: games.py プロジェクト: tthurman/stone-age-gnusto
    game_links[game].append(linkid)

for (linkid, url, name, comment, absolute) in details['links']:
    if comment == None:
        comment = ''
    else:
        comment = "\t" + comment
        
    links[linkid] = url + ' ' + name + comment

for game in details['reviews']:

    review = ''
    rating = ''
    
    if game[4]:
        review = game[4]
    else:
        review = 'No review is available.'

    if game[2] and game[2] in names:
        review += '<p class="reviewer">Reviewed by '+names[game[2]]+'</p>'

    result = bafread.writingfile('s'+game[0]+'.ini')
    result.write('review='+review+'\n');

    if game[0] in game_links:
        for link in game_links[game[0]]:
            result.write('link='+links[link]+'\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')


コード例 #3
0
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:
                gamescore = '?'
                
            if game[0] in game_to_title_id:
                gametitle = titles[game_to_title_id[game[0]]]
            else:
                gametitle = '?'