Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-06-2013, 05:15 PM   #1
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 8,449
Karma: 15640443
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Save Template with dependent variable

I have books from both Amazon and other sources, and I keep them all in calibre. I would like to save them normally if they aren't from Amazon, but if they are, then save them according to the filename they were given by Amazon
(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.

Last edited by eschwartz; 03-04-2013 at 09:15 PM.
eschwartz is offline   Reply With Quote
Old 02-06-2013, 05:49 PM   #2
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,923
Karma: 1673776
Join Date: Jan 2010
Location: France
Device: Many android devices
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}'))
The same thing in template program mode is something like
Code:
{#file:'ifempty($, template('{author_sort}/{title} - {authors}'))'}
The "something like"s are there because I don't have that column in my library so these are provided without testing.
chaley is offline   Reply With Quote
Old 02-06-2013, 06:39 PM   #3
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 8,449
Karma: 15640443
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (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  (
So I changed the template to
Code:
{#file:'ifempty($, template("{author_sort}/{title} - {authors}"))'}
and it was fixed.
Now it shows
Code:
Adams, Douglas/The Hitchhiker's Guide to the Galaxy - Douglas Adams

Thanks!!

Last edited by eschwartz; 03-04-2013 at 10:51 PM.
eschwartz is offline   Reply With Quote
Old 02-06-2013, 06:44 PM   #4
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,923
Karma: 1673776
Join Date: Jan 2010
Location: France
Device: Many android devices
Using the general program mode version avoids that sort of problem. You might want to consider it in case a title ever contains quotes (").
chaley is offline   Reply With Quote
Old 02-06-2013, 06:50 PM   #5
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 8,449
Karma: 15640443
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Yeah, that worked too.

Last edited by eschwartz; 03-04-2013 at 10:51 PM.
eschwartz is offline   Reply With Quote
Old 02-07-2013, 05:13 AM   #6
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,923
Karma: 1673776
Join Date: Jan 2010
Location: France
Device: Many android devices
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]]'))'}
chaley is offline   Reply With Quote
Old 02-17-2013, 08:01 PM   #7
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 8,449
Karma: 15640443
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (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!!!

Last edited by eschwartz; 03-04-2013 at 10:51 PM.
eschwartz is offline   Reply With Quote
Old 02-17-2013, 08:30 PM   #8
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 8,449
Karma: 15640443
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (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.

Last edited by eschwartz; 03-05-2013 at 12:18 AM.
eschwartz is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Troubleshooting a Save Template. Illyrie Library Management 5 02-08-2014 12:12 PM
Need help on a Save to Disk template fidvo Library Management 2 08-12-2012 04:34 PM
A little help with a save template...? Belfaborac Library Management 2 02-04-2011 10:47 PM
Library name as calibre template variable mdb5972 Calibre 6 01-15-2011 04:09 PM
save to disk template speakingtohe Calibre 9 05-29-2010 07:02 AM


All times are GMT -4. The time now is 03:27 PM.


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