diff --git a/src/calibre/ebooks/pdb/palmdoc/writer.py b/src/calibre/ebooks/pdb/palmdoc/writer.py index 784eca5523..835b2c6cb3 100644 --- a/src/calibre/ebooks/pdb/palmdoc/writer.py +++ b/src/calibre/ebooks/pdb/palmdoc/writer.py @@ -11,7 +11,7 @@ __docformat__ = 'restructuredtext en' import struct from calibre.ebooks.pdb.formatwriter import FormatWriter -from calibre.ebooks.txt.writer import TxtWriter, TxtNewlines, TxtMetadata +from calibre.ebooks.txt.writer import TxtWriter, TxtNewlines from calibre.ebooks.mobi.palmdoc import compress_doc from calibre.ebooks.pdb.header import PdbHeaderBuilder @@ -45,7 +45,7 @@ class Writer(FormatWriter): def _generate_text(self, spine): txt_writer = TxtWriter(TxtNewlines('system').newline, self.log) - txt = txt_writer.dump(spine, TxtMetadata()) + txt = txt_writer.dump(spine) txt_length = len(txt) diff --git a/src/calibre/ebooks/pdb/ztxt/writer.py b/src/calibre/ebooks/pdb/ztxt/writer.py index 6e974d1a67..fd7a07d7f9 100644 --- a/src/calibre/ebooks/pdb/ztxt/writer.py +++ b/src/calibre/ebooks/pdb/ztxt/writer.py @@ -11,7 +11,7 @@ __docformat__ = 'restructuredtext en' import struct, zlib from calibre.ebooks.pdb.formatwriter import FormatWriter -from calibre.ebooks.txt.writer import TxtWriter, TxtNewlines, TxtMetadata +from calibre.ebooks.txt.writer import TxtWriter, TxtNewlines from calibre.ebooks.pdb.header import PdbHeaderBuilder MAX_RECORD_SIZE = 8192 @@ -50,7 +50,7 @@ class Writer(FormatWriter): def _generate_text(self, spine): txt_writer = TxtWriter(TxtNewlines('system').newline, self.log) - txt = txt_writer.dump(spine, TxtMetadata()) + txt = txt_writer.dump(spine) txt_length = len(txt) diff --git a/src/calibre/ebooks/txt/output.py b/src/calibre/ebooks/txt/output.py index e4b7539b72..c21c834d76 100644 --- a/src/calibre/ebooks/txt/output.py +++ b/src/calibre/ebooks/txt/output.py @@ -28,13 +28,8 @@ class TXTOutput(OutputFormatPlugin): ]) def convert(self, oeb_book, output_path, input_plugin, opts, log): - metadata = TxtMetadata() - if opts.insert_metadata: - metadata.author = opts.authors if opts.authors else authors_to_string([x.value for x in oeb_book.metadata.creator]) if oeb_book.metadata.creator != [] else _('Unknown') - metadata.title = opts.title if opts.title else oeb_book.metadata.title[0].value if oeb_book.metadata.title != [] else _('Unknown') - writer = TxtWriter(TxtNewlines(opts.newline).newline, log) - txt = writer.dump(oeb_book.spine, metadata) + txt = writer.dump(oeb_book.spine) close = False if not hasattr(output_path, 'write'): diff --git a/src/calibre/ebooks/txt/writer.py b/src/calibre/ebooks/txt/writer.py index ea613010ef..09a79d322d 100644 --- a/src/calibre/ebooks/txt/writer.py +++ b/src/calibre/ebooks/txt/writer.py @@ -19,7 +19,7 @@ class TxtWriter(object): self.newline = newline self.log = log - def dump(self, spine, metadata): + def dump(self, spine): out = u'' for item in spine: content = unicode(item) @@ -32,12 +32,6 @@ class TxtWriter(object): content = self.specified_newlines(content) out += content - # Prepend metadata - if metadata.author != None and metadata.author != '': - if metadata.title != None and metadata.title != '': - out = (u'%s%s%s%s' % (metadata.author.upper(), self.newline, self.newline, self.newline)) + out - out = (u'%s%s%s%s' % (metadata.title.upper(), self.newline, self.newline, self.newline)) + out - # Put two blank lines at end of file end = out[-3 * len(self.newline):] for i in range(3 - end.count(self.newline)): @@ -145,8 +139,3 @@ class TxtNewlines(object): def __init__(self, newline_type): self.newline = self.NEWLINE_TYPES.get(newline_type.lower(), os.linesep) - -class TxtMetadata(object): - def __init__(self): - self.title = None - self.author = None