Prior art is from KOReader, actually ;p.
(I should know, it took a lot of pain and cursing to make it all behave somewhat properly).
Meaning I wouldn't necessarily encourage anybody to go that route unless you like stuff randomly breaking if you don't commit to keeping up to date on this stuff

.