View Single Post
Old 10-28-2015, 12:20 PM   #4
lisabeeren
Junior Member
lisabeeren began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2015
Device: Kindle
hi, me again :P

looking at metadata/meta.py, the code calls:

get_file_type_metadata() from calibre.customize.ui

calibre/customize/ui.py contains a lot of plugin stuff, so presumably it works its way through the plugin system for each file type.

in the case of kf8, i assume it ends up in the get_metadata() function of `calibre/ebooks/metadata/mobi.py`

this function's job is to place all the meta information in MetaInformation object called mi, see below:

Code:
    if mh.exth is not None:
        if mh.exth.mi is not None:
            mi = mh.exth.mi
    else:
        size = 1024**3
        if hasattr(stream, 'seek') and hasattr(stream, 'tell'):
            pos = stream.tell()
            stream.seek(0, 2)
            size = stream.tell()
            stream.seek(pos)
        if size < 4*1024*1024:
            with TemporaryDirectory('_mobi_meta_reader') as tdir:
                with CurrentDir(tdir):
                    mr = MobiReader(stream, log)
                    parse_cache = {}
                    mr.extract_content(tdir, parse_cache)
                    if mr.embedded_mi is not None:
                        mi = mr.embedded_mi
none of the books i have satisfy the first if-statement, so they fall through to the else. this creates a MobileReader object, and calls extract_content() on that. now the very first (or second) thing that extract_content() calls is:

Code:
self.check_for_drm()
which throws an exception in the case of DRM. this being the case, does that mean that many books (at least all the ones i have), you cannot access the author without first removing the DRM?

with thanks
lisabeeren is offline   Reply With Quote