View Single Post
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: 12,450
Karma: 8012886
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