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 10-27-2023, 01:13 PM   #1
AstroCalibre
Enthusiast
AstroCalibre began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2019
Device: Android smartphone
Author in cover image

Hi
When I generate the cover image of a book, the author's name appears at the bottom of the cover in the form "Last Name, First Name" (e.g. "Asimov, Isaac"). I want it in the form "First Name Last Name", without a comma and with the Last Name First Name reversed (e.g. "Isaac Asimov").
How can I do?
Thanks for attention,
Regards
AstroCalibre is offline   Reply With Quote
Old 10-27-2023, 05:11 PM   #2
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Your Authors column must be in that format
And your author-sort must be set to copy.

The template is on the Text tab of The Generate cover: Customize
but any thing you do there is going to be fragile as it handles many conditions of Authors
theducks is offline   Reply With Quote
Old 10-27-2023, 06:16 PM   #3
AstroCalibre
Enthusiast
AstroCalibre began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2019
Device: Android smartphone
Quote:
Originally Posted by theducks View Post
Your Authors column must be in that format
And your author-sort must be set to copy.

The template is on the Text tab of The Generate cover: Customize
but any thing you do there is going to be fragile as it handles many conditions of Authors
theduck, thanks for your ansewer!
I hoped that it could be done without changing the ordering of the authors (I want to leave it in the form "Asimov, Isaac"), by modifying, for example, the template in Generate cover.

Alternatively, I tried to do this: I created a custom column (#myauthors) and manually inserted the authors' names into it in the form that I want (e.g. Isaac Asimov & Arthur Clarke). Then I edit the template in Generate cover replacing the word "authors" with "#myauthors". It works but I was wondering if it is possible to create a custom column that generates automatically the names of the authors, without comma between surname and name, with surname and name inverted, and separated by an ampersand.
AstroCalibre is offline   Reply With Quote
Old 10-27-2023, 10:40 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,749
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by AstroCalibre View Post
Hi
When I generate the cover image of a book, the author's name appears at the bottom of the cover in the form "Last Name, First Name" (e.g. "Asimov, Isaac"). I want it in the form "First Name Last Name", without a comma and with the Last Name First Name reversed (e.g. "Isaac Asimov").
How can I do?
Thanks for attention,
Regards
Why are you generating the cover instead of downloading a cover for the book?
JSWolf is offline   Reply With Quote
Old 10-28-2023, 07:24 AM   #5
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,446
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by AstroCalibre View Post
theduck, thanks for your ansewer!
I hoped that it could be done without changing the ordering of the authors (I want to leave it in the form "Asimov, Isaac"), by modifying, for example, the template in Generate cover.
This footer template works for me
Code:
program:
# Show at most two authors, on separate lines.
authors = '';
for aut in sublist($authors, 0, 2, ' & ') separator '&':
	aut = swap_around_comma(aut);
	authors = list_join(' & ', authors, ' & ', aut, ' & ')
rof;
authors = list_re(authors, ' &amp; ', '(.+)', '<b>\1');
authors = re(authors, ' &amp; ', '<br>');
re(authors, '&amp;&amp;', '&amp;')
Quote:
Alternatively, I tried to do this: I created a custom column (#myauthors) and manually inserted the authors' names into it in the form that I want (e.g. Isaac Asimov & Arthur Clarke). Then I edit the template in Generate cover replacing the word "authors" with "#myauthors". It works but I was wondering if it is possible to create a custom column that generates automatically the names of the authors, without comma between surname and name, with surname and name inverted, and separated by an ampersand.
Do what the above template does to generate the author list in the custom column. Something like this:
Code:
program:
authors = '';
for aut in $authors separator '&':
	aut = swap_around_comma(aut);
	authors = list_join(' & ', authors, ' & ', aut, ' & ')
rof;
authors
EDIT: Here are simpler versions of the above templates that use list_re_group() instead of a for loop.

Cover template:
Code:
program:
# Show at most two authors, on separate lines.
authors = list_re_group($authors, ' &amp; ', '.', '(.*)', 'program: swap_around_comma($)');
num = count(authors, ' &amp; ');
authors = sublist(authors, 0, 2, ' &amp; ');
authors = list_re(authors, ' &amp; ', '(.+)', '<b>\1');
authors = re(authors, ' &amp; ', '<br>');
re(authors, '&amp;&amp;', '&amp;')
Custom column template:
Code:
program:
list_re_group($authors, ' & ', '.', '(.*)', 'program: swap_around_comma($)')

Last edited by chaley; 10-28-2023 at 11:31 AM. Reason: Added simpler templates
chaley is offline   Reply With Quote
Old 10-28-2023, 01:08 PM   #6
AstroCalibre
Enthusiast
AstroCalibre began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2019
Device: Android smartphone
Quote:
Originally Posted by chaley View Post
This footer template works for me
Code:
program:
# Show at most two authors, on separate lines.
authors = '';
for aut in sublist($authors, 0, 2, ' &amp; ') separator '&amp;':
	aut = swap_around_comma(aut);
	authors = list_join(' &amp; ', authors, ' &amp; ', aut, ' &amp; ')
rof;
authors = list_re(authors, ' &amp; ', '(.+)', '<b>\1');
authors = re(authors, ' &amp; ', '<br>');
re(authors, '&amp;&amp;', '&amp;')
Do what the above template does to generate the author list in the custom column. Something like this:
Code:
program:
authors = '';
for aut in $authors separator '&':
	aut = swap_around_comma(aut);
	authors = list_join(' & ', authors, ' & ', aut, ' & ')
rof;
authors
EDIT: Here are simpler versions of the above templates that use list_re_group() instead of a for loop.

Cover template:
Code:
program:
# Show at most two authors, on separate lines.
authors = list_re_group($authors, ' &amp; ', '.', '(.*)', 'program: swap_around_comma($)');
num = count(authors, ' &amp; ');
authors = sublist(authors, 0, 2, ' &amp; ');
authors = list_re(authors, ' &amp; ', '(.+)', '<b>\1');
authors = re(authors, ' &amp; ', '<br>');
re(authors, '&amp;&amp;', '&amp;')
Custom column template:
Code:
program:
list_re_group($authors, ' & ', '.', '(.*)', 'program: swap_around_comma($)')
Hi, chaley, very thanks for your answer, it helped me a lot.
I have tried both code (cover template and custum column template).
The code for custom column works perfectly also with multiple authors.
The code for Generate cover works well with single author, but with multiple authors such as "Asimov, Isaac & Clarke, Arthur" produce "Isaac Clarke & Arthur Asimov", or something like that.
AstroCalibre is offline   Reply With Quote
Old 10-28-2023, 01:14 PM   #7
AstroCalibre
Enthusiast
AstroCalibre began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2019
Device: Android smartphone
Quote:
Originally Posted by JSWolf View Post
Why are you generating the cover instead of downloading a cover for the book?
Hi JSWolf,
I have a lot of anthology, and I create an empty book for each story in the anthology. For this books I need to create a custom cover.
AstroCalibre is offline   Reply With Quote
Old 10-28-2023, 04:47 PM   #8
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,446
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by AstroCalibre View Post
The code for Generate cover works well with single author, but with multiple authors such as "Asimov, Isaac & Clarke, Arthur" produce "Isaac Clarke & Arthur Asimov", or something like that.
Works fine for me with your example authors, tested with both templates.

The book's metadata:
Click image for larger version

Name:	Clipboard01.jpg
Views:	120
Size:	23.7 KB
ID:	204461

The generated cover (using the second template):
Click image for larger version

Name:	Clipboard03.jpg
Views:	125
Size:	119.8 KB
ID:	204462

Don't know why it isn't working for you.

What version of calibre are you running?
chaley is offline   Reply With Quote
Old 10-28-2023, 05:22 PM   #9
AstroCalibre
Enthusiast
AstroCalibre began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2019
Device: Android smartphone
Quote:
Originally Posted by chaley View Post
Works fine for me with your example authors, tested with both templates.

The book's metadata:
Attachment 204461

The generated cover (using the second template):
Attachment 204462

Don't know why it isn't working for you.

What version of calibre are you running?
chaley, forgive me, now I tried again, and it works!
I don't understand why it was giving me the wrong output before.
Thanks for your help!
AstroCalibre is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I get metadata from cover image? The image is correct but all other data is wrong mydjtl Library Management 1 12-14-2017 05:15 PM
paste cover image changes image's size pipistrelosone Editor 1 10-07-2016 09:10 AM
Cover Image? MerlinMama Editor 9 06-18-2016 08:47 PM
Cover image isn't displaying as cover image Eugene88 Sigil 3 08-15-2012 04:05 PM


All times are GMT -4. The time now is 04:47 PM.


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