Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-07-2024, 10:42 PM   #1
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
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.
Comfy.n is offline   Reply With Quote
Old 03-07-2024, 10:45 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Advert
Old 03-07-2024, 10:46 PM   #3
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,103
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
It should be pretty easy to edit notes.db using DB Browser...

https://sqlitebrowser.org/
Karellen is offline   Reply With Quote
Old 03-07-2024, 10:49 PM   #4
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
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
Comfy.n is offline   Reply With Quote
Old 03-07-2024, 10:51 PM   #5
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Karellen View Post
It should be pretty easy to edit notes.db using DB Browser...

https://sqlitebrowser.org/
hmm, I have that program. But I don't see something like a Search and replace function in it? (i mean, without having to know how to issue sql commands...)
Comfy.n is offline   Reply With Quote
Advert
Old 03-07-2024, 10:52 PM   #6
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by kovidgoyal View Post
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.
oh i see, thanks
Comfy.n is offline   Reply With Quote
Old 03-07-2024, 10:56 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Comfy.n View Post
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
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.
kovidgoyal is offline   Reply With Quote
Old 03-07-2024, 11:09 PM   #8
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,103
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by Comfy.n View Post
hmm, I have that program. But I don't see something like a Search and replace function in it? (i mean, without having to know how to issue sql commands...)
Yes, you need to modify using SQL.

What edit do you need to make?
Karellen is offline   Reply With Quote
Old 03-07-2024, 11:11 PM   #9
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by kovidgoyal View Post
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.
Oh, I wish I could.

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).
Comfy.n is offline   Reply With Quote
Old 03-07-2024, 11:12 PM   #10
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Karellen View Post
Yes, you need to modify using SQL.

What edit do you need to make?
for starts: xx-large -> x-large
Comfy.n is offline   Reply With Quote
Old 03-07-2024, 11:31 PM   #11
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,002
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
I notice the files below under .calnotes - backup:

Click image for larger version

Name:	MWSnap 2024-03-08, 01_28_28.png
Views:	28
Size:	21.7 KB
ID:	206774

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...
Comfy.n is offline   Reply With Quote
Old 03-07-2024, 11:35 PM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Old 03-07-2024, 11:39 PM   #13
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
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.
Comfy.n is offline   Reply With Quote
Old 03-08-2024, 01:59 AM   #14
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Comfy.n View Post
Quote:
Originally Posted by Karellen View Post
It should be pretty easy to edit notes.db using DB Browser...

https://sqlitebrowser.org/
hmm, I have that program. But I don't see something like a Search and replace function in it? (i mean, without having to know how to issue sql commands...)
You could do this:
  • export the notes table in notes.db to a CSV
  • edit the CSV with a text editor or spreadsheet program
  • import the edited CSV back into the notes db notes table

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.
BetterRed is offline   Reply With Quote
Old 03-08-2024, 02:07 AM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
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.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:21 PM.


MobileRead.com is a privately owned, operated and funded community.