![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 15430
Join Date: Mar 2015
Device: Kobo Forma, Pocketbook Era
|
![]()
Hi folks!
Because I have a problem with one of the Calibre plugins, I deleted several of my self created columns to test if that helps - of course without backup. ![]() (I backed up the ~/.config folder (Linux), but I wasn't aware, the metadata is stored in a different folder). ![]() ![]() Is it still somehow possible to restore the deleted columns? Last edited by the_Pan; 10-17-2022 at 02:12 AM. |
![]() |
![]() |
![]() |
#2 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,718
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Custom column definitions are in the library to which you added them (in the metadata.db sqlite database). So, if you restore the relevant library in its entirety you should get them back.
BR |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 15430
Join Date: Mar 2015
Device: Kobo Forma, Pocketbook Era
|
Quote:
Even if I create the columns by hand before the restore process, they do not contain any data. |
|
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,444
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Library Maintenance→Restore Database almost surely won't work in your case. The problem: calibre backs up information for books in a file metadata.opf stored in each book folder. When you deleted the columns, calibre started making new backups with the columns removed. It writes these backup files at a rate of 1 backup file every 2 seconds. If calibre was running long enough after you deleted the columns then all the data for those columns are gone. There is no way to recover the deleted data short of restoring all the metadata.opf files from before you deleted the columns. But if you can do that then you can restore the metadata.db file as well. |
|
![]() |
![]() |
![]() |
#5 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 15430
Join Date: Mar 2015
Device: Kobo Forma, Pocketbook Era
|
Damn, I was afraid of that!
I have now found a ~1 year old backup of the database, which is definitely better than nothing. But of course this database is missing all since then added books. Could I copy the old .db file into the newer library and run restore function? Or would it be easier to edit the database itself with sqlite browser? |
![]() |
![]() |
Advert | |
|
![]() |
#6 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,444
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
One approach suggested by others on this forum is to:
|
||
![]() |
![]() |
![]() |
#7 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 15430
Join Date: Mar 2015
Device: Kobo Forma, Pocketbook Era
|
Okay, thanks a lot for now, I will that when I find the time.
|
![]() |
![]() |
![]() |
#8 | |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
JS Tool for You
Quote:
Before you start flailing, there is an "easy" way to restore your custom column data from an old metadata.db database that you have. [1] View Job Spy thread: https://www.mobileread.com/forums/sh...18&postcount=1 [2] Look at the Tool named "Import Metadata from CSV File". An image is attached here for your convenience. [3] Read the Tool's ToolTips by hovering your mouse everywhere in its dialog box for all of its widgets. [4] Open your "old" metadata.db with Calibre. [5] Use the Calibre "create catalog" function, specifying as a minimum the Book ID and the Custom Columns that you wish to restore. [6] Export the Catalog to a .csv file. [7] Open the .csv file in Calc/Excel (NOT a text editor) to ensure it has what you want in it. Ensure that all of the cells are "text", including Book ID. Create Column Header Names if they are missing. The Tool uses the Header Names. Remember to save the .csv as a UTF-8 file when saving the file as a .csv (e.g. Save Filter option in Calc). [8] Run Calibre. Quick Switch to your "broken" Library. [9] Recreate your missing custom columns, which will of course be empty. Restart Calibre. Back up your new metadata.db AFTER restarting. [10] Click the JS Icon dropdown menu arrow, and navigate to the Metadata submenu to find the "Import Metadata from CSV File" tool. Run it. [11] Point it to your new, valid .csv file as described and generated above. [12] "CSV Column Values to Match" is Book ID. "CSV Column Values to Import" from the .csv data is the first custom column to repair. "Target to Update" that same first missing custom column that you just created. "Match Expression" should be "EQUALS". [13] Execute in "Preview" mode, which is a "pretend" execution so you verify that the .csv's Book IDs match a large subset of your broken Library. [14] You should specify via the criteria that you only update certain or selected books. Do a few, then examine a few to verify all is well. [15] Update all matched books for that first custom column, and then repeat the process by only changing the "source" and "target" .csv columns for the other custom columns. Always execute in "Preview" before doing it for real. No need to reimport the .csv file unless you need to make changes to it in Calc/Excel. Remember to save the .csv as a UTF-8 file when saving the file as a .csv (e.g. Save Filter option in Calc). DaltonST Last edited by DaltonST; 10-16-2022 at 01:14 PM. |
|
![]() |
![]() |
![]() |
#9 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 15430
Join Date: Mar 2015
Device: Kobo Forma, Pocketbook Era
|
@DaltonST you almost saved my day!
I was able to restore the columns except from one now. The one I can't restore is a column with integers which shows me the percent I read in the book(it's from the kobotouchextend) |
![]() |
![]() |
![]() |
#10 |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
Create a new Short Text custom column, then update that with the csv %read in text format. Then try to use Calibre Mass Edit to copy from Text to Float %. Might get very lucky that it converts for you. Still, you have the old data to view although in text format.
DaltonST |
![]() |
![]() |
![]() |
#11 | |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,718
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
In my head calibre's Restore database feature gets re-branded as Rebuild or Recover database ![]() BR |
|
![]() |
![]() |
![]() |
#12 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,970
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
|
![]() |
![]() |
![]() |
#13 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 96
Karma: 15430
Join Date: Mar 2015
Device: Kobo Forma, Pocketbook Era
|
![]() Quote:
I converted all the 100% finished books into a normal true/false column and have them back again now too. Only a handful of unfinished books is still missing, but I'll get them into the library by hand. Again, thanks a lot. ![]() |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ratings Custom Columns Created From other Columns | Tanjamuse | Library Management | 4 | 09-28-2020 12:57 AM |
Custom sort order for custom columns? | matjojo | Library Management | 5 | 11-24-2019 11:30 AM |
Help Needed for Custom Columns Created From other Columns | Tanjamuse | Library Management | 5 | 09-02-2018 06:19 PM |
[Kindle] On device - how to restore columns? | AussieTupp | Devices | 15 | 04-16-2017 08:43 AM |
Custom Columns - How are you using yours? | nynaevelan | Library Management | 19 | 04-18-2011 12:42 AM |