View Single Post
Old 02-25-2014, 02:20 PM   #481
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by sheygetz View Post
OK, it seems
Code:
Source template:{tags}
Destination field:authors
does the trick.
Sorry about author_sort vs authors issue, the Kindle formats do not use the "authors" field, they only have the "author_sort" field so I got confused which one to use. Apparently calibre treats it as the authors field, which does make sense if I actually think about it. But you figured it out without me.

"author_sort" was correctly set, but it was also being ignored altogether.
Quote:
How can I truncate the author_sort here
Code:
Source template:{author_sort}: {title}
Destination field:title
to the first author's surname, please?

I found this somewhere
Code:
{author_sort:re(([^\,]+)(\,|$)(.*),\1)}
would it do the trick, and do I really need all of these brackets. I can't find explanations for them in the online help.
That code will give you just the first author surname, using a regex, the calibre guide is here: http://manual.calibre-ebook.com/regexp.html and those brackets/parentheses are vital. The first parentheses tell the regex to store the match as \1, to use later, the second parentheses allow you to search for (either|or), and the third parentheses, well, actually they are unnecessary. But it doesn't hurt either.

Last edited by eschwartz; 02-25-2014 at 03:31 PM.
eschwartz is offline   Reply With Quote