View Single Post
Old 03-18-2019, 06:54 AM   #2
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 Tanjamuse View Post
Hi.

When I save Books to disk with a comma separated tag column the output isn't sorted alphabetically when there's more than one tag in the column.

What's in the column in Calibre:

Angel The Series, Buffy The Vampire Slayer, Firefly

What it becomes in the folder on my computer:

Buffy The Vampire Slayer, Firefly, Angel The Series
You can sort the column like:

Code:
{tags:list_sort(0,\,)}
Quote:

This is my template for saving to disk. I know the tmp1 and tmp2 is the same one but I don't know how to remove one of the them and still keep the rest of it intact.

Code:
program: tmp1 = template('{#parent_fandom}/{#meta_fandom}/{#story_id}/{author} - {title}'); tmp2 = template('{#parent_fandom}/{#meta_fandom}/{#story_id}/{author} - {title}'); tmp3 = template('_ Multiple Crossovers/{#story_id}/{author} - {title}'); cmp(count(field('#meta_fandom'), ','), 3, re(re(tmp1,': ',' '),',',', '), re(re(tmp2,': ',' '),',',', '), tmp3)
I hope someone can help me, or at least clarify if it's a bug or normal in Calibre?
I had to reformat it to read it properly, but the following should be the same.
Code:
program:
tmp1 = template('{#parent_fandom}/{#meta_fandom}/{#story_id}/{author} - {title}');
tmp1 = re(re(tmp1,': ',' '),',',', ');
tmp3 = template('_ Multiple Crossovers/{#story_id}/{author} - {title}'); 
cmp(
	count(field('#meta_fandom'), ','),
	3, 
	tmp1,
	tmp1,
	tmp3
	)
And assuming the two fandom columns are the lists that need to be sorted, I'd probably rewrite it as:

Code:
program:
tmp1 = template('{#parent_fandom:list_sort(0,\,)}/{#meta_fandom:list_sort(0,\,)}');
tmp1 = re(re(tmp1,': ',' '),',',', ');
tmp4 = cmp(
	count(field('#meta_fandom'), ','),
	3, 
	tmp1,
	tmp1,
	'_ Multiple Crossovers'
	);
strcat(tmp4, template('/{#story_id}/{author} - {title}'))
But, I can't test that as I don't have the appropriate columns.
davidfor is offline   Reply With Quote