-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
36 lines (31 loc) · 1.04 KB
/
test.py
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
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
import sys
import os.path
from pymobi.mobi import BookMobi
from pymobi.util import hexdump
def main_cli(path):
if os.path.isfile(path):
book = BookMobi(path)
print('==== book ====')
for key, value in book.book.items():
print('%s: %s' % (key, value))
print('==== header ====')
for key, value in book.header.items():
print(key, value)
print('==== palmdoc ====')
for key, value in book.palmdoc.items():
print(key, value)
print('==== mobi ====')
for key, value in book.mobi.items():
print(key, value)
print('==== mobi exth====')
for key, value in book.mobi_exth.items():
print(key, value)
#for num in range(1, book.header['numberOfRecords']):
# rec = book.loadRecord(num)
# offset = book.records[num]
# print('==== record %d ====' % num)
# print(offset)
# hexdump(rec[:16])
if __name__ == '__main__':
main_cli(sys.argv[1])