コード例 #1
0
ファイル: pilgrim_convert.py プロジェクト: shuge/pilgrim
def main():
    if len(sys.argv) < 2:
        print usage
        exit(1)

    for f in sys.argv[1:]:
        if not os.path.exists(f):
            print "%r: No such file or directory" % (f)

        codec = utils.getDecoder(f)
        if codec:
            print "Converting...", f,
            name, ext = os.path.splitext(f)
            codec(f).save(name + ".png")
            print "=> %s.png" % (name)
        else:
            print "Unknown file format for %s..." % (f)
            print usage
コード例 #2
0
ファイル: show.py プロジェクト: jleclanche/pilgrim
def main():
	if len(sys.argv) < 2:
		print usage
		exit(1)
	
	files = []
	for f in sys.argv[1:]:
		if not os.path.exists(f):
			print "%r: No such file or directory" % (f)
		
		codec = utils.getDecoder(f)
		if codec:
			print "Converting...", f
			name, _ = os.path.splitext(f)
			files.append(codec(f))
		
		else:
			print "Unknown file format for %s..." % (f)
			print usage
	
	utils.show(files)