noembryo / KoHighlights

KOHighlights is a utility for viewing KOReader's highlights and/or export them to simple text, html, csv or markdown files.
MIT License
128 stars 5 forks source link

suggestion: compare highlights metadata files for same book's in sdr folder #6

Closed richo67 closed 4 years ago

richo67 commented 4 years ago

Hello, often I end up with two or more metadata lua files in the sdr books file, normally there is one .old and sometime som others. The reason is that I read books on more devices and sometime they do not manage synchronize and there is a conflict in file later.

It would be great if there would be sort of merge tool, which would merge those conflicting file into one nice. Merging only highlights and setting position to latest one.

It could be part of this or it could be some kind of command line tool. Do you think this could be useful and not too complex to make?

noembryo commented 4 years ago

Interesting.. How come you end up with more than one metadata file? I need a little more background here, since I never encounter such a case. Most of the time I have an metadata.old.lua file, but that one is always older then the current, so I wouldn't sync with it.

Anyway it looks doable, but the other metadata file must also be from the same book and use the same version cre (there was a version bump up recently).

richo67 commented 4 years ago

it is always as an effect of synching files from multiple devices on my personal cloud. Some devices I have off line or they have no connection for some time and when they sync then files was already changed before by some other device.

All files would be from same book. Only they all would have strange names with some id of a device and date when sync from cloud failed. So it would be something like this:

metadata.epub_aPad_Dec-02-181542-2019_Conflict.lua metadata.epub.lua metadata.epub.lua.old metadata.epub.lua_rNokia_Nov-30-102256-2019_Conflict.old metadata.epub_rNokia_Jan-09-095752-2020_Conflict.lua metadata.epub_rNokia_Nov-30-102301-2019_Conflict.lua version can be an issue, but still, does it effect highlights? Thanks for considering this

noembryo commented 4 years ago

Well, the version might matter, so I always check it.. Apart from this, I will try to find a way for the user to manually select a file for syncing with the currently selected book.

richo67 commented 4 years ago

Apart from this, I will try to find a way for the user to manually select a file for syncing with the currently selected book.

Maybe select only files in books sdr folder show it in check boxed list and let user to check which to merge

noembryo commented 4 years ago

Since the merging is happening in pairs anyway, what I could do is have an option to select a file to merge with the current..

richo67 commented 4 years ago

or ;-) merge all selected in turn with current.

noembryo commented 4 years ago

OK, last offer! File selector with multiple selections enabled... Do we have a deal? ;o)

richo67 commented 4 years ago

:-D sure, you are the boss. Thanks

noembryo commented 4 years ago

Bonus feature: KOHighlights will now load all the lua files of a book...

richo67 commented 4 years ago

Bonus feature: KOHighlights will now load all the lua files of a book...

It means it will automatically merge them? what would happen to those other lue files, will you remove them?

noembryo commented 4 years ago

No, no, it will display them as rows in the book list.

richo67 commented 4 years ago

And I could select more than two in the same time for merging? And possible option to remove them after merge (checkbox in merge dialog?)

noembryo commented 4 years ago

Nah, the mechanism is the same as before. Only pairs can be synced/merged. I wouldn't like to re-write all the code.. ;o)

For your case, the file selector (were you can select many files) is still the best solution. The reason to add the bonus (!) feature was to inform the user of the different .lua files and to allow to sync the freshly appeared ones..

richo67 commented 4 years ago

I understand. Good, thanks.

noembryo commented 4 years ago

Added with v.1.3.0.0