inspect_kindle_file.py: check a .mobi, .azw, or .azw3 file before translating it ================================================================================== What it does Reads only the file headers and prints the title, the format generation (MOBI 6, KF8/AZW3, or a joint file with both), the text encoding, the compression, the encryption field, and the language tag. It never changes the file. It needs Python 3 and nothing else. The encryption field is the same field BookTranslator's MOBI reader checks: any value other than 0 means the file is DRM-protected and will be rejected. Usage python3 inspect_kindle_file.py book.mobi python3 inspect_kindle_file.py *.azw3 Test files (checked 2026-10-29) Franz Kafka, "Die Verwandlung", Project Gutenberg eBook #22367 (public domain in the US). Download the files from Project Gutenberg rather than from us: Older Kindle file (MOBI 6): https://www.gutenberg.org/ebooks/22367.kindle.images Newer Kindle file (KF8): https://www.gutenberg.org/ebooks/22367.kf8.images EPUB3: https://www.gutenberg.org/ebooks/22367.epub3.images SHA-256 of the files we downloaded: 8d0a2b47b394c94f72668d1314ad1d4a76bb0c91b2cc924a07cb93e64ac7967a 22367.kindle.images e37df33abeb714439ca76489f4894b20e2b519e262598105e9ff322476109483 22367.kf8.images bfd98560075632c0b805720a00c3143044df38dae447e8c3c04f117bc4560d25 22367.epub3.images Project Gutenberg rebuilds its files from time to time, so a later download may have different hashes. The fourth test file is a copy of the MOBI 6 file with one change: the 2-byte encryption field (offset 12 of record 0) set to 2. It simulates a DRM-flagged file. It is not a real store purchase and cannot be opened by a reader app. Make it yourself with: python3 - <<'PY' import struct d = bytearray(open("22367.kindle.images", "rb").read()) off = struct.unpack(">I", d[78:82])[0] d[off + 12:off + 14] = struct.pack(">H", 2) open("drm-flag-set.mobi", "wb").write(d) PY Output we got (files saved as die-verwandlung.mobi, die-verwandlung.azw3, drm-flag-set.mobi, and die-verwandlung.epub) == die-verwandlung.mobi title: Die Verwandlung format: MOBI 6 text encoding: UTF-8 compression: PalmDOC encryption: none language: de verdict: OK to upload == die-verwandlung.azw3 title: Die Verwandlung format: KF8 (AZW3) text encoding: UTF-8 compression: PalmDOC encryption: none language: de verdict: OK to upload == drm-flag-set.mobi title: Die Verwandlung format: MOBI 6 text encoding: UTF-8 compression: PalmDOC encryption: Mobipocket DRM language: de verdict: DRM-protected: BookTranslator will reject it == die-verwandlung.epub ZIP container (EPUB or KFX-ZIP), not a MOBI-family file