示例#1
0
def main():
    pngfile_list = commands.getoutput('find images -name "*.png"').split('\n')

    for pngfile in pngfile_list:
        jsonfile = re.sub('^images', 'jsons',
                   re.sub('.png$', '.json', pngfile))
        testfile = re.sub('^images', 'tests', pngfile)
        try:
            confirmAndMakeDir(jsonfile)
            confirmAndMakeDir(testfile)

            figure = Figure(pngfile)
            figure.saveJSON(jsonfile)
            figure.saveTestPNG(testfile)
        except:
            print 'failed:', pngfile