TXT input encoding option honored

This commit is contained in:
John Schember 2009-04-05 19:43:59 -04:00
parent 011e2811d2
commit 3b09d01701
2 changed files with 4 additions and 30 deletions

View File

@ -21,7 +21,10 @@ class TXTInput(InputFormatPlugin):
def convert(self, stream, options, file_ext, log,
accelerators):
txt = stream.read()
ienc = stream.encoding if stream.encoding else 'utf-8'
if options.input_encoding:
ienc = options.input_encoding
txt = stream.read().decode(ienc)
md = markdown.Markdown(
extensions=['footnotes', 'tables', 'toc'],

View File

@ -70,35 +70,6 @@ def auto_convert(fmt, parent, db, rows):
else:
bad_rows.append(row)
continue
# defaults = db.conversion_options(db.id(row), fmt)
# defaults = defaults if defaults else ''
# options = get_config(fmt)(defaults=defaults).parse()
# mi = db.get_metadata(row)
# opf = OPFCreator(os.getcwdu(), mi)
# opf_file = PersistentTemporaryFile('.opf')
# opf.render(opf_file)
# opf_file.close()
# pt = PersistentTemporaryFile('.'+_fmt.lower())
# pt.write(data)
# pt.close()
# of = PersistentTemporaryFile('.'+fmt)
# of.close()
# cover = db.cover(row)
# cf = None
# if cover:
# cf = PersistentTemporaryFile('.jpeg')
# cf.write(cover)
# cf.close()
# options.cover = cf.name
# options.output = of.name
# options.from_opf = opf_file.name
# args = [options, pt.name]
# desc = _('Auto convert book %d of %d (%s)')%(i+1, total, repr(mi.title))
# temp_files = [cf] if cf is not None else []
# temp_files.extend([opf_file, pt, of])
# jobs.append(('any2'+fmt, args, desc, fmt.upper(), row_id, temp_files))
mi = db.get_metadata(row)
in_file = db.format_abspath(row, data)