geometer / FBReaderJ

Official FBReaderJ project repository
http://www.fbreader.org/FBReaderJ/
1.83k stars 802 forks source link

Bookmarks are not synchronized back from cloud #403

Open FiberMan opened 8 years ago

FiberMan commented 8 years ago

Steps to reproduce:

  1. Add book to device, read it, add some bookmarks -> book appeared in online library with bookmarks.
  2. Delete book from device.
  3. Go to Network Library and download the same book from cloud.
  4. Check Bookmark menu -> there are no bookmarks in "THIS BOOK" section. In fact, there are still bookmarks in "ALL BOOKS" section, but when I click on it - error appears: "File not found" (probably because in settings I have different folder for download from cloud).

    Possible solution

Seems like identification of book is based on the file path, not on the book content. I propose to make identification by file hash to fix synchronization issues. Then it will be no matter where the file has been moved, on what platform, etc. Just scan the device's folders, check the hash and compare it with hashes in Cloud to sync.

Moreover, if you have the same file in different locations on your device, your Library will have only one record with all the bookmarks and other attributes attached. No meter which exactly file you open to read.

Moreover 2, because all metadata will be linked to hash, it could be very simple to share it with others.

geometer commented 8 years ago

Yes, this is known problem, the metadata in the local db is stored by path, not by hash. Additionally it cannot take "same" bookmark for two different books. This will be fixed in next major update. (We do not want to make such big change in 2.6.* series as it is finally quite stable.)

As a workaround, delete all local data. You will lost the settings, but all synchronisable data will be loaded successfully.