03-07-2024, 10:42 PM | #1 |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Bulk editing html in notes.db
Is there a way to edit the notes.db file on a simple text editor, without harming the database structure? (html/css)
For example, I want to replace the string xx-large with x-large. Actually I did try this on Notepad++, but Calibre didn't like it. Then I restored my notes.db backup. (I hope there is some way other than having to run sql commands!) Last edited by Comfy.n; 03-07-2024 at 10:44 PM. |
03-07-2024, 10:45 PM | #2 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Just use copy/paste in the HTML view of the edit notes dialog. If you want to do it in bulk, then there is no easy way. You would bneed to write some code to export and re-import the notes.
|
Advert | |
|
03-07-2024, 10:46 PM | #3 |
Wizard
Posts: 1,103
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
|
03-07-2024, 10:49 PM | #4 |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Hmm, that works for each note, individually. I want to change like 1500 notes all at once, just like the search and replace feature that works with metadata.db
|
03-07-2024, 10:51 PM | #5 | |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Quote:
|
|
Advert | |
|
03-07-2024, 10:52 PM | #6 |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
|
03-07-2024, 10:56 PM | #7 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That will require code. You can write a small python script to export the notes using the calibre api, process them and re-import them. Run it with calibre-debug. But there is no pre-cooked solution to do this.
|
03-07-2024, 11:09 PM | #8 |
Wizard
Posts: 1,103
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
|
03-07-2024, 11:11 PM | #9 | |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Quote:
I was testing a composite column containing the author notes, that displays both in book details and as a tooltip in booklist view, just out of curiosity. Then I thought I might just keep it, but I need to style the html provided in GR Author Notes. I guess I could edit the html inside the plugin, but this would work only for the new notes generated with it. It looks interesting in Book Details, but I'd prefer a smaller author picture and a smaller h1 tag (it has also a font-size styling - xx-large). |
|
03-07-2024, 11:12 PM | #10 |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
|
03-07-2024, 11:31 PM | #11 |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
I notice the files below under .calnotes - backup:
Those are very easy to edit in bulk, by just loading them on a text editor and doing the Search and Replace on all open documents... If I could rebuild the database with these modified files... |
03-07-2024, 11:35 PM | #12 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Those are backups, I dont recall in what circumstances exactly they are used, but you can try corrupting the notes.db file or deleting it and see if they get restored. Make proper backups before doing that of course.
|
03-07-2024, 11:39 PM | #13 |
want to learn what I want
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Will try that tomorrow, thanks. Definitely not a good thing to do when I'm kind of somnolent.
|
03-08-2024, 01:59 AM | #14 | ||
null operator (he/him)
Posts: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Do an export and import without any edits first to make sure you have the basics working. The export and import options are in the File menu of DB Browser for SQLite. I've done that with tables from metadata.db to good effect… a long time ago. And of course work on a copy of .calnotes. Added: just noticed the notes table in notes.db is virtualised for FTS, not sure of the implications of that. BR Last edited by BetterRed; 03-08-2024 at 02:04 AM. |
||
03-08-2024, 02:07 AM | #15 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I highly doubt using a third party sqlite tool is going to work. This is text is FTS indexed and has various things going on that are not encapsulated in notes.db, for instance it links to resources not stored in the db file. Editing it directly will likely break something.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bulk Tag Editing (Bulk-adding Prefixes for Heirarchical Tags) | Jackwc | Library Management | 3 | 01-14-2024 05:24 PM |
Bulk Editing Comments | ilovejedd | Library Management | 3 | 01-14-2018 07:23 PM |
Bulk metadata editing | paoletto | Library Management | 7 | 10-29-2014 12:42 PM |
Editing Metadata in Bulk | ballast | Calibre | 5 | 08-15-2010 03:14 PM |
Editing Metadata in Bulk Question | lwpack | Calibre | 10 | 07-19-2009 11:40 PM |