I pushed code to save db preferences when the GUI exits and to restore them when the db is restored. Preferences are saved to the file metadata_db_prefs.json in the same directory as metadata.db.
Preferences are not saved by command line tools. I don't think any of them modify preferences, so this shouldn't be a problem. Ahh ... perhaps saved searches can be created and deleted by command line tools. These changes will be lost if the gui hasn't run between the command line invocation and the restore.
There is another possible hole. If we have the sequence a) the preferences file came from db version N, b) calibre has been updated to db version N+1 and only a command line tool has run, and c) the upgrade function modifies preferences, then the restored preferences may be incorrect. Up to now, all db preference modifications have been done outside the db upgrade functions, so this isn't currently an issue.
|