Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-16-2011, 03:15 AM   #16
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Arco Witter View Post
Hello,
folder_on_device_10
Script:
Code:
{title:folderOnDevice({#genre},{series},{series_index},{#max_number_in_series},10)}
folder_on_device_6
Script:
Code:
{title:folderOnDevice({#genre},{series},{series_index},{#max_number_in_series},6)}
Your problem is almost certainly related to using sub-template evaluation in single-function mode. Doing so will fail if the result of evaluating a template produces a character with 'meaning', such as a comma, a colon, or a bracket. As I have said before, I consider it a bug that it works at all, but enough people have asked be to leave it so I don't take it out.

Try using template program mode or general program mode. In general program mode, your templates would be something like the following. I haven't run them, so there might be a syntax error somewhere.

folder_on_device_10
Script:
Code:
program: folderOnDevice(field('title'), field('#genre'),field('series'), field('series_index'), field('#max_number_in_series'), 10)
folder_on_device_6
Script:
Code:
program: folderOnDevice(field('title'), field('#genre'), field('series'), field('series_index'), field('#max_number_in_series'), 6)
Another thing you can do that will improve performance dramatically is eliminate the constant arguments and fetch them inside your function. for example, use
Code:
val = kwargs.get('title')
genretext = kwargs.get('#genre')
in your function instead of passing the values as arguments. If you want a default value such as '', use genretext = kwargs.get('#genre', '')
chaley is offline   Reply With Quote
Old 12-16-2011, 07:43 AM   #17
Arco Witter
Member
Arco Witter began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Jan 2010
Device: iRex iLiad
Thanks for answering and the idea of the arguments!!

Unfortunately the files are still dumped in the wrong folder, currently the folder has this name:
program_ folderondevice(field('title'), field('#genre'),field('series'), field('series_index'), field('#max_number_in_series'), 10)
File names are:
de wetten van de magie 00 proloog - de aflossing.jpg
de wetten van de magie 00 proloog - de aflossing.mobi
etc.

It's just weird that this does work with most books. I did not see any difference in the meta information of the books.
However, currently it seems that all books are dumped in this wrong folder, so using 'program:' for the columns does not work.

edit: It looks like the export script is evaluated to remove all characters that are illegal in files before it is evaluated for script/functions.
However, when I use a '/' in the genre, I see it replaced with a '_' on exporting. Still the value of the column is ok.
Is it possible to use the column value without it evaluating completely when exporting? (Since it has already been evaluated when Calibre started or meta information changed)

edit2:
I replaced everything as it was: function is still the same. Changed the column back to: {title:folderOnDevice({#genre},{series},{series_in dex},{#max_number_in_series},10)}
also changed the export script to: {#folder_on_device_10:||/}{title}

Now it works for each book!!

Last edited by Arco Witter; 12-16-2011 at 08:02 AM.
Arco Witter is offline   Reply With Quote
Advert
Old 12-16-2011, 08:29 AM   #18
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,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The template "program: ..." not working is my fault. I must have broken composite column evaluation in save-to-disk at some point. I have submitted a fix.

You should change the folder_on_device_10 column to not use sub-templates once my change is released (next week probably). There are several ways that sub-templates can break, and tracing them can be exceedingly mysterious.
chaley is offline   Reply With Quote
Old 12-16-2011, 08:31 AM   #19
Arco Witter
Member
Arco Witter began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Jan 2010
Device: iRex iLiad
This corner is mysterious indeed

I think I found out why some series are ok and some get exported to the wrong folder.
When I use a series named 'De stalen rat' it is changed internally to 'Stalen rat, de' so maybe this happens with several other fields too.

I changed the arguments, that works great.
Also i will await a new version. Thanks for your great support!!
Arco Witter is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Old Thread] Folder Structure gplauche Calibre 29 02-13-2012 05:13 PM
Send to Device (structure) mgmueller Calibre 1 02-21-2010 01:54 PM
Send to device folder structure? Slite Calibre 2 01-09-2010 05:20 AM
Folder structure doubt Oletros iRex 3 01-01-2009 07:00 AM
SD Folder structure ctitanic Amazon Kindle 1 12-30-2007 12:48 PM


All times are GMT -4. The time now is 08:10 AM.


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