Ejemplo n.º 1
0
def determine_global_table(outfile):
    global GLOBAL_LABEL
    tablefiles, labelfiles = {}, {}
    for line in open(path.join(tblpath, MASTER_FILENAME)):
        line = line.strip()
        if not line or line[0] == "#":
            continue
        while "  " in line:
            line = line.replace("  ", " ")
        label, h2, tablefile = line.split()
        tablefiles[h2] = (label, tablefile)
        labelfiles[label] = tablefile
    h = md5hash(outfile)
    if h in tablefiles:
        label, filename = tablefiles[h]
    else:
        print "Unrecognized rom file: %s" % h
        for i, label in enumerate(sorted(labelfiles)):
            print "%s. %s" % ((i+1), label)
        if len(labelfiles) > 1:
            selection = int(raw_input("Choose 1-%s: " % len(labelfiles)))
            label = sorted(labelfiles.keys())[selection-1]
            filename = labelfiles[label]
        else:
            raw_input("Using this rom information. Okay? ")
            label = sorted(labelfiles.keys())[0]
            filename = labelfiles[label]
    print label
    GLOBAL_LABEL = label
    set_global_table_filename(filename)
Ejemplo n.º 2
0
 def md5hash(self):
     return utils.md5hash(self.email())