wustho / epy

CLI Ebook (epub2, epub3, fb2, mobi) Reader
GNU General Public License v3.0
962 stars 52 forks source link

Added hash instead of location to identify ebook #23

Closed tionis closed 2 years ago

tionis commented 3 years ago

Script now hashes files and uses the hexdigest of them to identify an ebook this should enable having the same ebook in different locations and still have the ability to sync bookmarks and reading position between them. This does not include any way to handle old config files

tionis commented 3 years ago

Please note that I have only tested this in my setup.

tionis commented 3 years ago

I just discovered a problem in line 2229 with this pull request will fix this tomorrow

tionis commented 3 years ago

Pull request should now be ready to merge (if wanted of course). I tested all cases I could think of (only in Linux, but I didn't touch any code that could be platform specific as hashlib is part of the standard library).

wustho commented 3 years ago

Hey mate, sorry just open my gmail, somehow it didn't notify me from my phone.

Cool solution mate! It never occur to me using hash. I will test it first...

Tho probably we need more to consider. Since it will cost us state file readibility. Readibility is main reason I chose json instead of sqlite, for easy debugging by editing directly to the file... But I wil test using this hash version first in vase I miss some good things...

tionis commented 3 years ago

Yeah sure, I realized after I published the pull request that it's quite a radical change.
Another thing to note could be that people who use this tool with an ebook that may change in a tiny way would be unable to keep their bookmarks (even though this may not be that important, as then the positions may change).
I also thought about using a different piece of metadata to identify books like ISBN but that would be probably to unreliable.

tionis commented 3 years ago

And for the record: another solution would be using fuzzy hashes to trade the possibility of one hash matching two similar but unrelated files for the ability to handle nearly identical books as the same one.

wustho commented 2 years ago

Hello there, sorry so much I don't think epy ready for this. So, I was considering this, and made a major refactor to epy to use sqlite database for reading state... And when I consider this, I was thinking that the motivation I made epy is how it can resume my reading state without providing much of cli args...

tionis commented 2 years ago

Well you don't really need any extra cli arguments, but ok.
I will probably maintain the my fork of it if you should change your mind.
Thanks for your considerations!