Quantcast
Channel: MobileRead Forums - Devices
Viewing all articles
Browse latest Browse all 3394

Adding logic to send to device template

$
0
0
Hi all!

I've been using a template to send books to my Android tablet, Chaley helped me refine it in a previous thread back in 2016. I want to add more refinement to the template to further sort books on my device. Here's the current template:

Code:

program:
        ta = test(field('series'), strcat(field('series'),'/',field('#serind'),' - ',field('#firstauth'),' - ',field('title')), strcat(field('#firstauth'),' - ',field('title')));
        str_in_list(field('tags'), ',', 'Fiction',
                strcat('eBooks/Fiction/', ta),
                strcat('eBooks/Non-Fiction/', ta))))

So, the way I understand this code, str_in_list creates an if-else condition, if true the book goes to the fiction folder, else it goes to non-fiction. Now what if I want to separate thrillers from sci-fi/fantasy? Basically what I want is:

If fiction
If Sci-Fi OR Fantasy
put in sci-fi fantasy folder
else
put in thriller folder
else
put in non-fiction folder


I understand that this will be a nesting of str_in_list commands, but my question is regarding the OR in the second if statement, how do I do OR in Calibre?

Code:

str_in_list(field('tags'), ',', 'Sci-Fi', {OR} 'Fantasy'
Thanks!

Viewing all articles
Browse latest Browse all 3394

Latest Images

Trending Articles



Latest Images