I was able to fix it up to handle the two new annotation types (subject to code review).
Main changes:
Code:
ANNOT_CLASS_NAMES = {
0: "annotation.personal.bookmark",
1: "annotation.personal.highlight",
2: "annotation.personal.note",
3: "annotation.personal.clip_article", # value not verified
10: "annotation.personal.handwritten_note",
11: "annotation.personal.sticky_note",
}
Added 10 & 11.
(made this a class attribute to consolidate duplicated strings)
Code:
elif name in self.ANNOT_CLASS_NAMES.values():
obj["startPosition"] = self.decode_position(val.pop(0))
obj["endPosition"] = self.decode_position(val.pop(0))
obj["creationTime"] = datetime.datetime.fromtimestamp(val.pop(0) / 1000.0).isoformat()
obj["lastModificationTime"] = datetime.datetime.fromtimestamp(val.pop(0) / 1000.0).isoformat()
obj["template"] = val.pop(0)
if name == "annotation.personal.note":
obj["note"] = val.pop(0)
elif name == "annotation.personal.handwritten_note":
obj["handwritten_note_nbk_ref"] = val.pop(0)
elif name == "annotation.personal.sticky_note":
obj["sticky_note_nbk_ref"] = val.pop(0)
Added
handwritten_note_nbk_ref property. I verified that these match to a symbol in
ion_symbol_table in the
nbk with the pen annotations for a page of the Print Replica document.
I also could not keep myself from fixing linter complaints about 'unreferenced variable i' (by replacing with '_').
Scribe also seems to have another piece of data in
font_prefs structure (value
0). I added 'unknown2' to absorb it. I checked another Kindle and it does not have this.
Code:
"font.prefs": {
"typeface": "_INVALID_,und:bookerly",
"lineSp": 1,
"size": 3,
"align": 0,
"insetTop": 64,
"insetLeft": 200,
"insetBottom": 8,
"insetRight": 200,
"unknown1": -1,
"bold": 1,
"userSideloadableFont": "",
"customFontIndex": -1,
"mobi7SystemFont": "",
"mobi7RestoreFont": false,
"readingPresetSelected": "",
"unknown2": 0
},
Maybe is page animation flag? I'll do some more checking.
Not sure what I'm going to do with this, but excited to have discovered it. Thanks @jhowell & @j.p.s.!