09-20-2018, 03:22 PM | #1 |
Wizard
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); 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); 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. |
09-21-2018, 09:27 AM | #2 |
Connoisseur
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 |
09-21-2018, 09:29 AM | #3 |
Wizard
Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
|
09-21-2018, 10:18 AM | #4 |
hopeless n00b
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 |
|
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 |