The JW Library app allows you to export your precious notes. For geeks and hackers who wants to modify these note automatically (with Python for example, or directly with a SQLite editor), it can be tedious to:
- unzip the backup file
- zip the content back into the backup file
The tiny little scripts are not complicated, but allow you to do it quickly.
Please find them at:
https://github.com/Bibelo/JWInflator
jwlibrary_unzip
to extract the content of the backup file:
$ ./jwlibrary_unzip -h
Usage: ./jwlibrary_unzip <JW backup>.jwlibrary
Will simply expand to a folder containing the .jwlibrary file, the manifest.json and the userData.db.
You can then simply edit the userData.db with SQLite software.
The JW Library file will be modified, so make a backup of this file if needed.
jwlibrary_zip
to zip the contents back:
$ ./jwlibrary_zip -h
Usage: ./jwlibrary_zip <JW folder>
- <JW folder>: WITHOUT the .jwlibrary extension
folder created by jwlibrary_deflate
bears the name of the JW backup file without the .jwlibrary extension
contains the .jwlibrary file, the manifest.json and the userData.db
Will simply update the existing .jwlibrary file with the modified userData.db and the manifest.json.
Will remove these last two files so make a backup if needed.
Example: unzip
We have an backup file UserDataBackup_2022-10-22_TEST.jwlibrary
:
$ ls -1A
UserDataBackup_2022-10-22_TEST.jwlibrary
jwlibrary_unzip
jwlibrary_zip
Open the content of that file:
$ ./jwlibrary_unzip UserDataBackup_2022-10-22_TEST.jwlibrary
Archive: UserDataBackup_2022-10-22_TEST.jwlibrary
inflating: manifest.json
inflating: userData.db
We now have a directory with the name of the backup file, without the .jwlibrary
extension :
$ ls -1A UserDataBackup_2022-10-22_TEST/
UserDataBackup_2022-10-22_TEST.jwlibrary
manifest.json
userData.db
The backup file has been moved into that directory.
You can now play inside the userData.db
file.
Example: zip
Once your modification of the SQLite database has been made, it's time to zip it back to be able to restore it to JW Library.
Don't enter the directory. Just type the command with the name of directory, which is the name of the backup file, without the .jwlibrary
extension:
$ ./jwlibrary_zip UserDataBackup_2022-10-22_TEST/
updating: manifest.json (deflated 32%)
updating: userData.db (deflated 53%)
The directory is deleted and the zip backup file is now back into the current directory, ready to be restored in JW Library.
$ ls -1A
UserDataBackup_2022-10-22_TEST.jwlibrary
jwlibrary_unzip
jwlibrary_zip