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 11-19-2011, 07:32 PM   #1
cipesek
Junior Member
cipesek began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: none
Variable "Send to device" path

Hi everybody,
I want my calibre to find out if book comes in series and accordingly to answer choose from saving it to "author_sort" folder or "_series_" folder....please - where I catch wrong grip?

Code:
{series:'test($,
strcat("Knihy/_",field("series"),"_/",field("series_index"),". ",field("title")," (",field("author"),")"),
strcat("Knihy/",field("author_sort"),"/",field("title")," (",field("author"),")"))'}
PS: Even start may be wrong using "series" as output variable, but I couldn't use #var from some reason i don't get....
cipesek is offline   Reply With Quote
Old 11-20-2011, 03:39 AM   #2
chaley
Grand Sorcerer
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: 11,862
Karma: 7036057
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I tried using your template in a custom column and it produced a result, so it isn't clear what your problem is. What problem are you are having? Where are you using that template when it doesn't do whatever you want?

As an aside, you might be better off using something like
Code:
{series:'test($,
template("Knihy/_[[series]]_/[[series_index]].[[title]] ([[author]])"),
template("Knihy/[[author_sort]]/[[title]] ([[author]])"))'}
Expressing the result as a template evaluation seems clearer to me than doing it as a series of concatenated values.

Even better (for me) would be to use general program mode, letting you use {} instead of [[ ]] to bracket field references in the template.
Code:
program:
test(field('series'), 
	template("Knihy/_{series}_/{series_index}.{title} ({author})"),
	template("Knihy/{author_sort}/{title} ({author})"))
chaley is offline   Reply With Quote
Advert
Old 11-20-2011, 05:02 AM   #3
cipesek
Junior Member
cipesek began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: none
THANX A LOT! ..."general program" shows some error, but "[[]]" code works smoothly

BTW: problem was program dont accepted my template and used last working template instead...

PS: can I somehow detect biggest "series_index" for book in selected series, to automatically choose number of prefix zeros before series number? (e.g.: if in series of transfered book is some book labeled like "195-th part", than use for series_index 3 digits...) ....its no big deal, but for series like Coollorado westerns, Perry Rhodan, Ren Dhark.... there are tens/houndreds of storyes )

Last edited by cipesek; 11-20-2011 at 05:14 AM.
cipesek is offline   Reply With Quote
Old 11-20-2011, 05:45 AM   #4
chaley
Grand Sorcerer
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: 11,862
Karma: 7036057
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by cipesek View Post
THANX A LOT! ..."general program" shows some error, but "[[]]" code works smoothly
What error?
Quote:
PS: can I somehow detect biggest "series_index" for book in selected series, to automatically choose number of prefix zeros before series number? (e.g.: if in series of transfered book is some book labeled like "195-th part", than use for series_index 3 digits...) ....its no big deal, but for series like Coollorado westerns, Perry Rhodan, Ren Dhark.... there are tens/houndreds of storyes )
No. Templates operate on one book at a time. There is no way to get information that requires scanning the database.
chaley is offline   Reply With Quote
Old 11-20-2011, 05:58 AM   #5
cipesek
Junior Member
cipesek began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Oct 2011
Device: none
This error:
Quote:
...
ValueError: Failed to calculate path for save to disk.
...
Error: 'Formatter' object has no attribute 'column_name'
cipesek is offline   Reply With Quote
Advert
Old 11-20-2011, 06:35 AM   #6
chaley
Grand Sorcerer
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: 11,862
Karma: 7036057
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Thank you. That helped find a bug when using GPM templates in save-to-disk.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"add metadata as 1st page" won't work on batch [send to device] Bellychaser Devices 3 01-25-2011 03:25 PM
Save cover upon "Send to device" silentguy Calibre 1 11-17-2010 04:44 AM
How to change "Send to device" without folders? Skydog Calibre 12 05-23-2010 12:13 PM
template for "send to device" customization sbin Calibre 8 01-07-2010 07:22 AM
"Send to device" problems with 0.5.14 / PRS-505 TMF Calibre 0 06-14-2009 05:16 PM


All times are GMT -4. The time now is 10:30 PM.


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