-def main(infile, encoding, outfile, output_encoding):
+def get_fsize(fp):
+ try:
+ fp.seek(0, os.SEEK_END)
+ except IOError:
+ return None # File size is unknown
+ size = fp.tell()
+ fp.seek(0, os.SEEK_SET)
+ return size
+
+
+def main(infile, encoding, outfile, output_encoding, use_pbar, quoting_style):
+ if use_pbar:
+ size = get_fsize(infile)
+ if size is None:
+ use_pbar = False
+
+ print("Converting: ", end='', file=sys.stderr)
+ sys.stderr.flush()
+
+ if use_pbar:
+ pbar = ttyProgressBar(0, size-1)
+ cur_pos = 0
+