Giter Site home page Giter Site logo

mobi-python's Introduction

Mobi Python Library

This should be considered alpha quality software.

This library provides a little API for accessing the contents of an unencrypted .mobi file. Here's a short example:

from mobi import Mobi

book = Mobi("test/CharlesDarwin.mobi");
book.parse();
# this will print, 1 record at a time, the entire contents of the book
for record in book:
    print record

This library provides quite a lot of access to the metadata included in any mobibook. For example, Gutenburg's Origin of the Species:

>>> pprint(book.config)
{'exth': {'header length': 356,
          'identifier': 1163416648,
          'record Count': 15,
          'records': {100: 'Charles Darwin',
                      101: 'Project Gutenberg',
                      105: 'Natural selection',
                      106: '1999-12-01',
                      109: 'Public domain in the USA.',
                      112: 'http://www.gutenberg.org/files/2009/2009-h/2009-h.htm',
                      201: '\x00\x00\x00\x00',
                      202: '\x00\x00\x00\x01',
                      203: '\x00\x00\x00\x00',
                      204: '\x00\x00\x00\x01',
                      205: '\x00\x00\x00\x06',
                      206: '\x00\x00\x00\x02',
                      207: '\x00\x00\x00)',
                      300: '\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf4\xed\xec\xbe@\x94'}},
 'mobi': {'DRM Count': 0,
          'DRM Flags': 0,
          'DRM Offset': 4294967295,
          'DRM Size': 0,
          'EXTH flags': 80,
          'First Image index': 334,
          'First Non-book index': 329,
          'Format version': 6,
          'Full Name': 'The Origin of Species by means of Natural Selection, 6th Edition',
          'Full Name Length': 64,
          'Full Name Offset': 604,
          'Generator version': 6,
          'Has DRM': False,
          'Has EXTH Header': True,
          'Input Language': 0,
          'Language': 9,
          'Mobi type': 2,
          'Output Language': 0,
          'Start Offset': 2808,
          'Unique-ID': 4046349163,
          'header length': 232,
          'identifier': 1297039945,
          'text Encoding': 1252},
 'palmdoc': {'Compression': 2,
             'Encryption Type': 0,
             'Unknown': 0,
             'Unused': 0,
             'record count': 327,
             'record size': 4096,
             'text length': 1336365}}
>>>

Retrieving Author and Title

The author and title of a book can be retrieved using the author() and title() methods respectively on a Mobi() object. The parse() method needs to have already been called.

mobi-python's People

Contributors

eshellman avatar jazzycamel avatar jeffayle avatar kroo avatar taiiwo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mobi-python's Issues

Release version

Could you please release any kind of version you have here? I would really like to see a nice, wget-able link :)

How can I get the cover image?

I have read the mobi module, however I cannot find anything related to mobi file's cover image. Is there any method to extract the cover image from mobi file?

Your tool can't read a file

I'm trying to read mobi file like in readme, but I get unreadable mess in output, like this:

601041161091086260104101971006260103117105100101626011410110210111410111099101 t12111210161341161119934 t1051161084 t849798108101 o102 C11111011610111011611534 f10510810111211111561484848495050505049573247626047 C1111147 o102 9811110012162601001051186260112 h10110510310411661344811211634 w10510011610461344910110934 a10810510311061341061171151161051021213462847279776583 P897867727978604711261341061171151161051021213462847279776583 P8965 N11111810110

how can I fix this?

Missing "utils" library

It's used throughout __init__.py to call todict(), but the code is not in this repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.