View Single Post
Old 09-17-2018, 04:31 AM   #12
Divingduck
Wizard
Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.Divingduck ought to be getting tired of karma fortunes by now.
 
Posts: 1,166
Karma: 1410083
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
Quote:
If I can create a whole bunch of templates, does that mean that I can create a lot of different versions based on the libaries I have?
Yes. This is something where you use the general program mode within the template language like I show in post #7

Quote:
I would much prefer a option like I posted yesterday with counting and then adding them to a folder called: Multiple Crossovers, that would make them much easier to find.
You can use the "Template program mode" - something like this:
Code:
program: 

tmp1 = template('{#fandom_main:sublist(0,2,\,)} - {#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');
tmp2 = template('Multiple Crossovers/{author}/{title} ({#story_id})');

	cmp(
		count(
			field('#fandom_main'), 
			','), 
		2, 
		tmp1, 
		tmp2, 
		tmp2)
tmp1 and tmp2 are two different templates (you can adust it like you need it). cmp compares two values and give in this case two different templates depending on count back. You need to use the function field() to use the values of the metadata. ',' is the separator for the values (change it to what you need, e.g. '&'). In this example the template 1 is used if count is less than 2.

Reference:
https://manual.calibre-ebook.com/gen...p-x-y-lt-eq-gt
https://manual.calibre-ebook.com/tem...l-program-mode

Last edited by Divingduck; 09-17-2018 at 04:46 AM.
Divingduck is offline   Reply With Quote