|
|
#1 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 127
Karma: 99998
Join Date: Nov 2012
Location: United States
Device: Kindle Touch (Wifi only)
|
Save Template with dependent variable
(so they match the .sdr folder, with real pagenumbers and highlights). How do I set the save template so it uses {author_sort}/{title} - {authors} as usual, ONLY IF the custom field {#file} is empty? If it's filled in, the template should be that instead.
__________________
Join Dropbox to access your files on the go! (If you sign up via this link, we both get a 500MB bonus.) Use Dropbox and calibre2opds to access your calibre catalog anywhere. Last edited by eschwartz; 03-04-2013 at 08:15 PM. |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,879
Karma: 285970
Join Date: Jan 2010
Location: France
Device: Sony PRS-300, HTC WM6.5, Samsung Galaxy Nexus, HTC Sensation
|
Something like the following in general program mode should do the job, assuming that #file contains the exact filename.
Code:
program: ifempty(field('#file'), template('{author_sort}/{title} - {authors}'))
Code:
{#file:'ifempty($, template('{author_sort}/{title} - {authors}'))'}
__________________
Support calibre developers at no cost to you by using calibre's get books feature. Use Calibre Companion to wirelessly connect your Android phone or tablet to calibre charles.haleys.org/calibre |
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 127
Karma: 99998
Join Date: Nov 2012
Location: United States
Device: Kindle Touch (Wifi only)
|
It worked perfectly -- except for one thing; since I have titles with apostrophes, I got a template error. For instance, The Ultimate Hitchhiker's Guide to the Galaxy.
Code:
EXCEPTION: Formatter: failed to scan program. Invalid input - Douglas Adams')) near ( Code:
{#file:'ifempty($, template("{author_sort}/{title} - {authors}"))'}
Now it shows Code:
Adams, Douglas/The Hitchhiker's Guide to the Galaxy - Douglas Adams Thanks!!
__________________
Join Dropbox to access your files on the go! (If you sign up via this link, we both get a 500MB bonus.) Use Dropbox and calibre2opds to access your calibre catalog anywhere. Last edited by eschwartz; 03-04-2013 at 09:51 PM. |
|
|
|
|
|
#4 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,879
Karma: 285970
Join Date: Jan 2010
Location: France
Device: Sony PRS-300, HTC WM6.5, Samsung Galaxy Nexus, HTC Sensation
|
Using the general program mode version avoids that sort of problem. You might want to consider it in case a title ever contains quotes (").
__________________
Support calibre developers at no cost to you by using calibre's get books feature. Use Calibre Companion to wirelessly connect your Android phone or tablet to calibre charles.haleys.org/calibre |
|
|
|
|
|
#5 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 127
Karma: 99998
Join Date: Nov 2012
Location: United States
Device: Kindle Touch (Wifi only)
|
Yeah, that worked too.
__________________
Join Dropbox to access your files on the go! (If you sign up via this link, we both get a 500MB bonus.) Use Dropbox and calibre2opds to access your calibre catalog anywhere. Last edited by eschwartz; 03-04-2013 at 09:51 PM. |
|
|
|
|
|
#6 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,879
Karma: 285970
Join Date: Jan 2010
Location: France
Device: Sony PRS-300, HTC WM6.5, Samsung Galaxy Nexus, HTC Sensation
|
Just to be complete ...
Using the special bracket ([[ and ]] instead of { and }) specifier avoids the embedded quote and apostrophe problem in template program mode
Code:
{#file:'ifempty($, template('[[author_sort]]/[[title]] - [[authors]]'))'}
__________________
Support calibre developers at no cost to you by using calibre's get books feature. Use Calibre Companion to wirelessly connect your Android phone or tablet to calibre charles.haleys.org/calibre |
|
|
|
|
|
#7 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 127
Karma: 99998
Join Date: Nov 2012
Location: United States
Device: Kindle Touch (Wifi only)
|
For some reason this template works perfectly to show what the result will be in a custom field -- no matter what form I use -- but when I try to transfer a book over, it always ignores the template I entered under Preferences --> send books to device.
HELP!!!
__________________
Join Dropbox to access your files on the go! (If you sign up via this link, we both get a 500MB bonus.) Use Dropbox and calibre2opds to access your calibre catalog anywhere. Last edited by eschwartz; 03-04-2013 at 09:51 PM. |
|
|
|
|
|
#8 |
|
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 127
Karma: 99998
Join Date: Nov 2012
Location: United States
Device: Kindle Touch (Wifi only)
|
Never mind. I found another thread that explained this problem -- http://www.mobileread.com/forums/sho...d.php?t=159523
For some reason the send books to device template still insists there is no such thing as any of my custom fields, but hey, it works anyway, I'm happy. I've decided to set the save template for the device and leave the generic save for other devices.
__________________
Join Dropbox to access your files on the go! (If you sign up via this link, we both get a 500MB bonus.) Use Dropbox and calibre2opds to access your calibre catalog anywhere. Last edited by eschwartz; 03-04-2013 at 11:18 PM. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Troubleshooting a Save Template. | Illyrie | Library Management | 2 | 11-24-2012 01:54 PM |
| Need help on a Save to Disk template | fidvo | Library Management | 2 | 08-12-2012 03:34 PM |
| A little help with a save template...? | Belfaborac | Library Management | 2 | 02-04-2011 09:47 PM |
| Library name as calibre template variable | mdb5972 | Calibre | 6 | 01-15-2011 03:09 PM |
| save to disk template | speakingtohe | Calibre | 9 | 05-29-2010 06:02 AM |