View Single Post
Old 10-28-2015, 02:07 PM   #8
lisabeeren
Junior Member
lisabeeren began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2015
Device: Kindle
hmm, yes, you're right. it is still able to read the author, etc. when the book has DRM... though i have no idea where calibre does this :P

i did find a way of getting the author though, the fetchEXTHFields() function of the moby.py MetadataReader doesn't read the author, but i can modify it so it does:

Code:
   def fetchEXTHFields(self):
        stream = self.stream
        record0 = self.record0

        # 20:24 = mobiHeaderLength, 16=PDBHeader size
        exth_off = unpack('>I', record0[20:24])[0] + 16 + record0.start
        image_base, = unpack('>I', record0[108:112])

        # Fetch EXTH block
        exth = self.exth = StreamSlicer(stream, exth_off, record0.stop)
        nitems, = unpack('>I', exth[8:12])
        pos = 12
        # Store any EXTH fields not specifiable in GUI
        for i in xrange(nitems):
            id, size = unpack('>II', exth[pos:pos + 8])
            content = exth[pos + 8: pos + size]
            pos += size

            self.original_exth_records[id] = content

            if id == 100: # added this
                print(content)  # content is the author
thanks for your help!
lisabeeren is offline   Reply With Quote