def __init__(self, header, stream, log, options): record0_size = len(header.section_data(0)) if record0_size == 132: self.reader = Reader132(header, stream, log, options) elif record0_size in (116, 202): self.reader = Reader202(header, stream, log, options) else: raise EreaderError( 'Size mismatch. eReader header record size %s KB is not supported.' % record0_size)
def ereader_header_info(header): h0 = header.section_data(0) print('Header Size: %s' % len(h0)) if len(h0) == 132: print('Header Type: Dropbook compatible') print('') ereader_header_info132(h0) elif len(h0) == 202: print('Header Type: Makebook compatible') print('') ereader_header_info202(h0) else: raise EreaderError('Size mismatch. eReader header record size %i KB is not supported.' % len(h0))
def __init__(self, header, stream, log, options): self.log = log self.encoding = options.input_encoding self.log.debug('202 byte header version found.') self.sections = [] for i in range(header.num_sections): self.sections.append(header.section_data(i)) self.header_record = HeaderRecord(self.section_data(0)) if self.header_record.version not in (2, 4): raise EreaderError('Unknown book version %i.' % self.header_record.version) from calibre.ebooks.metadata.pdb import get_metadata self.mi = get_metadata(stream, False)
def __init__(self, header, stream, log, options): self.log = log self.encoding = options.input_encoding self.log.debug('132 byte header version found.') self.sections = [] for i in range(header.num_sections): self.sections.append(header.section_data(i)) self.header_record = HeaderRecord(self.section_data(0)) if self.header_record.compression not in (2, 10): if self.header_record.compression in (260, 272): raise DRMError('eReader DRM is not supported.') else: raise EreaderError('Unknown book compression %i.' % self.header_record.compression) from calibre.ebooks.metadata.pdb import get_metadata self.mi = get_metadata(stream, False)