File: parse.py

package info (click to toggle)
python-ebooklib 0.19-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 648 kB
  • sloc: python: 1,800; makefile: 132; sh: 52
file content (25 lines) | stat: -rw-r--r-- 556 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sys

import ebooklib
from ebooklib import epub
from ebooklib.utils import debug

book = epub.read_epub(sys.argv[1])

debug(book.metadata)
debug(book.spine)
debug(book.toc)

debug('================================')
debug('SMIL')

for x in  book.get_items_of_type(ebooklib.ITEM_SMIL):
    debug(x)

debug('================================')
debug('DOCUMENTS')

for x in  book.get_items_of_type(ebooklib.ITEM_DOCUMENT):
    if x.is_chapter():
        debug('[{}] media_overlay={}'.format(x, x.media_overlay))
debug('================================')