how to retrieve notes? #948
Replies: 8 comments
-
The filename of the .json file is the (URI-component encoded) unique identifier of the book. When you open a book, it will look for the .json file with the unique identifier defined in the book. So you don't have to do anything special when syncing or making backups. It should just work. If it doesn't, there are a few possibilities:
To debug and to manually work around the issue, I'd suggest:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. I am not a developer or a coder, and I use the terminal only when really necessary. Can you add the full terminal code that are required to
I have not been able to do that. I can change the folder & file name, of course. |
Beta Was this translation helpful? Give feedback.
-
If using Flatpak: |
Beta Was this translation helpful? Give feedback.
-
I received "Can't open file" when I tried the --verbose argument using Flatpak. I removed the Flatpak version and installed the PPA for Ubuntu, copied the folder to the new location, can not use --verbose but the file is empty of any notes or annotation. |
Beta Was this translation helpful? Give feedback.
-
@alicethedreamer try the following command:
It'll open your files app (assuming you use nautilus, the default file manager for PopOS, Ubuntu and other distributions), and your notes will be inside one of those .json files right at the end. Usually the file starts with some info about the book and only then shows your notes and stuff |
Beta Was this translation helpful? Give feedback.
-
To elaborate, What happens when Foliate opens a book
Notice that the .json file is completely independent of the book. The only thing that links the .json file to a particular book is the fact that the name of the .json file is the unique identifier of the book. It doesn't care about where the book is stored. As long as you open a book of the same identifier, it will load the notes associated with that identifier. How to backup or sync annotationsGiven the above, to backup annotations, you simply have to backup the .json file. To restore your backup, you just put the .json file back to its original location. For example, suppose you're reading a book with a unique identifier
How does one get the unique identifier of the bookWell, you can open the About This Book dialog (Ctrl + I) to see all the identifiers of a book. Unfortunately, you can't tell which one is designated as unique from this (which is really an oversight that should be mended). Furthermore, it shows the parsed identifier, rather than the raw identifier used to name the .json file. One can trying viewing the book's source file to get the identifier, but that's a bit too much trouble. So an easier and more reliable way is to run with the
in which case one knows for sure, that this .json file is the one that Foliate is reading from and writing to. Now, if you're trying to recover lost notes, this alone isn't helpful. This only tells you where Foliate expects the notes to be. However if you have the notes backed up somewhere, or the notes are really still there, just stored with a different filename, then simply copying or renaming the file will resolve the issue. Finding orphaned dataAs mentioned above, it's possible that the data is not lost, only that the data isn't associated with the correct unique identifier. If that's the case, one can use something like grep -l "Foobar" ~/.local/share/com.github.johnfactotum.Foliate/*.json or, for Flatpak, grep -l "Foobar" ~/.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate/*.json will show a list of .json files containing the word "Foobar". Alternatively, you can also search in Foliate's library view for orphaned data. While you probably won't be able to directly open the book, you can click on the three-dot menu and choose "Export Annotations…" to get a copy of the .json file. |
Beta Was this translation helpful? Give feedback.
-
I keep copies of the books folders as well as .json folders as backups. I was able to retrieve the annotations to one of the books, a recent one, by copying the .json file connected to the book from a backup folder to the
I had lost the notes when I opened the book file from a backup folder. So I think what had happened is when I opened the book (not attached to the .json file) from the backup folder, it saved this new location and didn't load the annotations. I don't know how the .json file is not loaded properly but was saved with no notes in it, because I could find only one .json file that is connected with the book in these current and backup Foliate folders. I couldn't retrieve the notes to another book which I had lost some time ago, I assume it was before Foliate 2.4.0. From my experience, I conclude that opening the book file from another drive/folder location changes the .json file connected with book, and this remains an issue for me. Thanks for the detailed answer. |
Beta Was this translation helpful? Give feedback.
-
Well, either it's not loaded, or the notes might have been lost while saving the file. Currently it silently assumes that there's no data when it encounters any error while reading the file. Which means that if the .json file is corrupted in any way you would lose the whole file. Which is bad and probably should be changed. On the other hand, it's not impossible that the notes might have been lost when saving the file. I know that GJS had changed how GObjects properties work in the past and it's possible that annotation objects were incorrectly serialized. One might be able to test to see which of these is more likely. Inspect the .json file. If the JSON object doesn't even have an
Whatever reason that might have caused it, the location of the book file has no bearing on the issue. That much I am certain of. In any case this is the easiest possibility to test for: just open some books from different locations and see if you can reproduce the issue. |
Beta Was this translation helpful? Give feedback.
-
Question:
I took a lot of notes and highligted text on a epub file, which I understand are saved on .json file (stored under /.var/app/com.github.johnfactotum.Foliate/data/com.github.johnfactotum.Foliate). I recently opened the file of the same epub book from another backup directory, which didn't have any highlights, and now I cannot find the way to retrieve the previous notes and highlights.
Version:
Beta Was this translation helpful? Give feedback.
All reactions