Quote:
Originally Posted by imnnrv
Thank you for you help!
It almost works, except it doesn't count some of authors/books: it think there is less than X books of this authors even if there are 10 and more books.
I've tried to rename them, move these books to new library - all the same (so it doesn't depends on library size). Tried to make X=1 and even then there was 1 author (3 books) counted as <1.
Made test with plugin "Author Book Count': it counts right, so i don't think it's problem with tags.
Can you please check the code for mistakes?
program:
first_author = list_item($authors, 0, '&');
books_by_author = book_count('authors:"""=' & first_author & '"""', 0);
X = 2;
if books_by_author < X then
answer = template('Fiction/{languages}/{author_sort} - {pubdate} - {title}')
else
answer = template('Fiction/{languages}/{author_sort:sublist(0,1,&)}/{series}/{series:|| }{series_index:|| - }{pubdate} - {title}')
fi;
answer
|
I forgot to specify numeric comparison instead of lexical (string) comparison in my original template. In lexical comparison, '10' is less than '2'.
Try this:
Code:
program:
first_author = list_item($authors, 0, '&');
books_by_author = book_count('authors:"""=' & first_author & '"""', 0);
X = 2;
if books_by_author <# X then
answer = template('Fiction/{languages}/{author_sort} - {pubdate} - {title}')
else
answer = template('Fiction/{languages}/{author_sort:sublist(0,1,&)}/{series}/{series:|| }{series_index:|| - }{pubdate} - {title}')
fi;
answer
The change is
Quote:
if books_by_author <# X then
|