View Single Post
Old 09-15-2019, 12:37 PM   #8
kacir
Wizard
kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.kacir ought to be getting tired of karma fortunes by now.
 
kacir's Avatar
 
Posts: 3,463
Karma: 10684861
Join Date: May 2006
Device: PocketBook 360, before it was Sony Reader, cassiopeia A-20
Quote:
Originally Posted by Cool Javelin View Post
I did think about using a plugin to swap author and title after the fact, It just feels a bit like fixing an issue rather then preventing it in the first place. It is an option I will look into. It does seem the author vs. title swap is the most common issue.
The Quick preferences plugin does have a tickmark for "Swap Names" This might be what you are looking for.
Just make two identical entries and on one of them check the option to "Swap Names"

When dealing with non-standard authors, the format is usually Firstname Lastname, or Lastname, Firstname
Sometimes the coma separates multiple authors.
So, when I imported a number of documents this way, I searched calibre for
authors:";"
then I selected the documents where the semi-colon separates multiple authors and replaced ';' with '&'

Please notice that you can save your favorite search and replace Regular Expressions and this will be one of them.

then I searched for
authors:",[^,]*,"
selected all cases where the commas separates multiple authors and replaced ',' with '&'

Having dealt with author names with multiple comas I searched for
authors:","
selected all cases where the comma separates multiple authors and replaced ',' with '&'

Now I can finally deal with Surname, Name case, so I search for
authors:","
replace
([^,]*), (.*)
with
\2 \1

Calibre remembers search queries, the bulk edit Search and Replace dialog can save your replacements, so this can be done very quickly if you use Calibre to process various weirdly named documents, fanfiction or that 10* year old directory with books in txt format.

You can also write script in your favorite file manager or operating system scripting language (I use Linux shell) and process or filter the filenames before importing into Calibre. There are numerous programs that people use to rename or sort files with photos mp3s. I used Krusader and krename on several occasions. TotalCommander, and its bulk rename of course when processing files on Windows.
kacir is offline   Reply With Quote