Thread: Bulk Edit Title
View Single Post
Old 04-19-2018, 01:11 AM   #3
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by tarisea View Post
Can someone explain in small words how to fix the title of added books coming in as

Title (Series Info) or sometimes Title (Series Info) (Publisher)

I would love to put Series Info into the Series column but I will settle for dumping everything after the first ( into a customer column.

Small words. All the programing and expressions go right over my head. Thank you very much
How the metadata is read for a book being added to calibre is set on the "Adding books" page of the preferences. There are two main options. The first is whether to read the metadata from the metadata inside the book. This is my preferred option as more and more books have reasonable metadata.

The next is the regex used to get the metadata from the file name. This is used if the above option is turned off, or the book doesn't contain metadata. From what you are saying, you probably have a simple regex such as:
Code:
(?P<title>.+) - (?P<author>[^_]+)
That would put everything before a dash into the title, and everything after it into the author. There should be a few examples on the Adding books page, but exactly what you need depends on the file names being used. For example, if I take the first example as exactly what you see in the title, then the file name probably looked something like:
Code:
title (series info) - author

Skin Game (The Dresden Files 15) - Jim Butcher
If that is correct, then the following should work:

Code:
(?P<title>[^_].+) ?\s*\((?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\)\s*-\s*(?P<author>[^_-]+) ?
That shouldn't be hard to expand to include the publisher, or different delimiters around the series info. But, suggesting more, I would need to know more about the file names you are seeing.
davidfor is offline   Reply With Quote