captn3m0 / cosmere-books

Script to build EPUB/MOBI/PDF versions of various books by Brandon Sanderson
Do What The F*ck You Want To Public License
41 stars 9 forks source link

Annotations #25

Open seajaysec opened 4 years ago

seajaysec commented 4 years ago

Would it be possible to add in the annotations that Brandon has on his site? I'd love to read those alongside the books right from my ereader.

https://www.brandonsanderson.com/brandon-sanderson-online-library/#annotations

captn3m0 commented 4 years ago

I've read most of thee on the website, but this sounds doable. I'll get to it someday.

Since switching between 2 ebooks won't really be the best way, do you have any suggestions on how to approach this better?

BeeeWall commented 4 years ago

The eBook versions of Warbreaker (at least from Google Play and Amazon) handle it by putting all the annotations at the end and putting a link to the annotations for each chapter at the start and end of said chapter, and a link back at the start and end of every annotation. But I don't know if that's something that'd be a pain to automatically (or worse manually) do for the books, don't really know enough of how this sort of thing works.

captn3m0 commented 4 years ago

This does sound doable, however the problem becomes complicated because you need to supply the ebook yourselves, which makes it hard to get right. So far what this project does:

[Content on the internet] -> [this project] -> ebooks :tada:

But in this case, we need to do:

[original book] + [annotations from the internet] -> [annotated ebooks]

This project can't provide the original book (for obvious copyright reasons), but making sure that the code works with all ebooks across multiple publishers+editions without breaking formatting etc is going to be tough.

But it would be sooo cool to read!

BeeeWall commented 4 years ago

Yeah not sure how to do it, myself. Zero promises, but I might take a look at it, because I've been trying to get back into coding and this seems like something not too crazy. But then, I've never touched Ruby, so anything I make might be kinda ugly lol.

captn3m0 commented 4 years ago

I just added annotation support to the Rhythm of War serialization. The annotations are picked from the reddit thread, which means I'll need to do a commit every week.

Please test and give feedback if this looks good?

BeeeWall commented 4 years ago

I've got a hastily-written thing set up to add annotations to the EPUB version of Elantris, but since I haven't used Ruby before, some things are horribly ugly (surely there's a way to append the Hash s I need to append without 7 (!) nested merge statements?), so I'll need to neaten it up a bit (or a lot) before uploading it.

Unfortunately, it will likely only work with specific EPUBs, and will need some tweaking to work on other books. But it's progress!

captn3m0 commented 4 years ago

Neat-o! :1st_place_medal:

Happy to merge this as an experimental feature whenever you're ready, and maybe work on making it more generic...

BeeeWall commented 4 years ago

Opened the PR earlier today at #32

Not really sure how to have it pass a file or anything, so currently it requires downloading the repo and running the script, since I don't think you can add a file to the Docker folder easily. But otherwise it works well, and I've neatened it up somewhat so it's not as horrendus.

Over the next few days I'll look into modifying it to work for the Mistborn books probably.

BeeeWall commented 4 years ago

Hmm. Just looked into adding annotations for the Mistborn books, but I just realized I only own the collections of 3 books rather than the individual eBooks, and so might not be able to do it. Sorry.