View Single Post
Old 08-10-2019, 01:54 PM   #11
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,806
Karma: 103362673
Join Date: Apr 2011
Device: pb360
Quote:
Originally Posted by ilovejedd View Post
Awesome work! Question though, how do you use this (syntax)? I'm assuming Linux only? Will this work on a Linux LiveUSB?

Thanks!
The C code needs to be compiled. It is not linux specific, but the POSIX mmap() call might not be supported everywhere. It should work fine on a Linux LiveUSB with a C compiler or with a compiled binary copied from a compatible linux system.

Microsoft has been misleadingly claiming POSIX compliance for decades, but it is my understanding that Microsoft Windows Subsystem for linux (or whatever it is called) is the real deal.

If you have a C compiler and it doesn't work, I can make a small change that just reads the entire azw3r file into a buffer since it is very unlikely that one would ever be too large to do that.

Maybe a pythonista will come along and crank out a python equivalent or improvement.

To compile:
Code:
cc -o azw3r azw3r.c
To run (1st is for notes only, 2nd is for highlights only, 3rd for both highlights and notes, and 4th sorts the notes to be by where they are in the book):
Code:
azw3r -i name.azw3r > name.notes
azw3r -h -i name.azw3r > name.highlights
azw3r -h -n -i name.azw3r > name.notes
azw3r -i name.azw3r | sort -n > name.notes
Example output:
Code:
97434   97443   Note:   'Not correct definition for this book.'
114792  114796  Note:   'Should be in x-ray terms category.'
135617  135632  Note:   'Same as Tut'
533488  533494  Note:   'Not a person.'
553723  553726  Note:   'Not a podcast.'
712228  712235  Note:   'Not a video game.'
The output of the C program can be the end product, or it can be processed into some other format or used as input for some other program, such as the perl script attached to the first post that inserts the notes and/or hightlights into the kindleunpack rawml output of the book.
j.p.s is offline   Reply With Quote