From fa2ce0e09d865f5c52f49b147333d9a2cc2da85f Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 17 Feb 2015 19:25:53 +0100 Subject: script reorganization --- pixelterm/unpixelterm.py | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'pixelterm/unpixelterm.py') diff --git a/pixelterm/unpixelterm.py b/pixelterm/unpixelterm.py index 46c0c83..1159197 100644 --- a/pixelterm/unpixelterm.py +++ b/pixelterm/unpixelterm.py @@ -2,7 +2,7 @@ import os, sys, os.path from collections import defaultdict -from pixelterm import xtermcolors +from pixelterm.xtermcolors import xterm_colors from PIL import Image, PngImagePlugin try: import re2 as re @@ -16,7 +16,7 @@ def parse_escape_sequence(seq): while i 1 and args.output: - parser.print_help() - print('You probably do not want to overwrite the given output file {} times.'.format(len(args.input))) - sys.exit(1) - - for f in args.input: - if len(args.input) > 1: - print(f.name) - img, metadata = unpixelterm(f.read()) - pnginfo = PngImagePlugin.PngInfo() - pnginfo.add_text('pixelterm-metadata', json.dumps(metadata)) - foo, _, _ = f.name.rpartition('.pony') - output = args.output or foo+'.png' - if args.output_dir: - output = os.path.join(args.output_dir, os.path.basename(output)) - img.save(output, 'PNG', pnginfo=pnginfo) - -if __name__ == '__main__': - main() - -- cgit