View Single Post
Old 04-18-2022, 07:39 AM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by zakman View Post
So I just imported a list of my books from Goodreads into Calibre and need to do some cleanup. All of the imported books that are part of a series are now titled like so (apologies for extra ASCII):

Title---------------------------------------------------------Series
=======================================
Book Name (The Blah Saga, #7)-------------------------(empty)

If possible, I'd like to change the metadata so it's more in line with the rest of my library:

Title------------------Series
===============================
Book Name----------The Blah Saga [7]

Is this possible? If so, how? I'm pretty new to maniupulating the data like this in Calibre, so the more details, the better. Thanks!
You can do this with calibre's bulk metadata search and replace. It requires 3 search/replace operations.

The steps:
  1. *Back up your library*. Things can go very wrong and you might need to get back to ground 0.
  2. Assuming you have more than one book, press E to open bulk metadata edit.
  3. Click on the Search and replace tab.
  4. If needed, change the Search mode to "Regular Expression.
  5. Do the first search and replace to copy the series number to calibre's series_index column.
    Click image for larger version

Name:	Clipboard01.jpg
Views:	84
Size:	151.9 KB
ID:	193301
    Press the Apply button.
  6. Do the second S/R to copy the series name to calibre's series column.
    Click image for larger version

Name:	Clipboard02.jpg
Views:	75
Size:	156.3 KB
ID:	193302
    Press the Apply button.
  7. Finally, remove the extraneous information from the title.
    Click image for larger version

Name:	Clipboard03.jpg
Views:	78
Size:	152.6 KB
ID:	193303
    Press the OK button to apply the S/R and close the dialog.
The regular expression
Code:
^(.*) \((.*), #(\d*)\)
says Starting at the beginning of the line (the title) find all characters up to " (", capturing them in the first capture group. Next the characters up to ", #" (the series name) are captured in group 2. Finally, the digits up to the closing ')' are captured in group 3.

Note that the images show the regular expression
Code:
^(.*).*\((.*), #(\d*)\)
The one above replaces the ".*\(" with " \(", which is cleaner. I didn't bother to remake the images.
chaley is offline   Reply With Quote