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 09-20-2018, 03:22 PM   #1
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
Different results from Template column and edit template for saving books

Hi everyone.

Why does a template test-column and the template tester for Saving Books to Disk show me 2 different results? I have a template test-column in my library in which I have this and it shows me exactly an output exactly like I want:

1 Fandom = folder named after the fandom
2 Fandoms = folder named Crossovers
3 Fandoms or more = folder named Multiple Crossovers

Code:
program: 
tmp1 = template('{#fandoms:sublist(0,2,\,)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');
tmp2 = template('Crossovers/{#fandoms:sublist(0,2,\,)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');
tmp3 = template('Multiple Crossovers/{author}/{title} ({#story_id})');
check = count(field('#fandoms'), '&');
check=cmp(check,3,check,check,3);
## new version as "case of count =x"
switch(
		check,
				1, tmp1,
				2, tmp2,
				tmp3);
When I add this in the template editor for Saving to Disk it only creates the Multiple Crossovers folder.

I've tried removing all the spaces and everything else I could think of, but it still only shows the Multiple Crossovers folder, and when I save books none of the folders are created.

Here's the "compressed" version:

Code:
program:tmp1=template('{#fandoms:sublist(0,2,\,)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');tmp2=template('Crossovers/{#fandoms:sublist(0,2,\,)}{#fandom_secondary:sublist(0,2,\,)}/{author}/{title} ({#story_id})');tmp3=template('Multiple Crossovers/{author}/{title} ({#story_id})');check=count(field('#fandoms'), '&');check=cmp(check,3,check,check,3);switch(check,1, tmp1,2, tmp2,tmp3);
Here's 3 versions of what it's supposed to do:

Harry Potter/Mireille/Tired (AO3-13781403)

Crossovers/Criminal Minds & Criminal Minds Beyond Borders/youvebeenwinchesterd/Cheer You Up (AO3-14946017)

Multiple Crossovers/Sevensmommy/Roots Before Branches (AO3-14882856)

I hope someone can help.

Tanjamuse

Last edited by Tanjamuse; 09-21-2018 at 09:28 AM.
Tanjamuse is offline   Reply With Quote
Old 09-21-2018, 09:27 AM   #2
readx
Connoisseur
readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.readx 's ceiling is 100% spider-free.
 
Posts: 82
Karma: 118402
Join Date: Jul 2009
Device: Cybook Gen3
Check max_path and reserved characters (: (colon))
see https://docs.microsoft.com/de-de/win.../naming-a-file
readx is offline   Reply With Quote
Old 09-21-2018, 09:29 AM   #3
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
Quote:
Originally Posted by Tanjamuse View Post
Crossovers/Criminal Minds & Criminal Minds Beyond Borders/youvebeenwinchesterd/Cheer You Up (AO3-14946017)
I got other examples than this where it doesn't work, if that's what you meant.
Tanjamuse is offline   Reply With Quote
Old 09-21-2018, 10:18 AM   #4
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,111
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
Not really a programmer but just a quick thought, if you're counting the number of occurrences of "&" in #fandoms, wouldn't that return (n-1) fandoms?

e.g.
0: one fandom
1: two fandoms
2: three fandoms
ilovejedd is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving to disk svda Library Management 6 04-10-2015 07:42 PM
Saving to Disk LRC1962 Library Management 1 06-20-2012 07:58 PM
Losing files when saving saving to disk theaccountant Library Management 4 03-10-2011 02:38 PM
Saving to disk htaylor Calibre 2 01-04-2009 08:29 PM


All times are GMT -4. The time now is 05:16 AM.


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