calibre
Calibre JaymesRS 9 months ago 100%

Could use some help with writing a template program for filling out a column

I use the page count plugin plus a template program I adapted from one found online (included below) to build a column that categorizes books by length. (I use this to build collections I use when I’m picking my next to read)

I’d like to exclude certain books from getting a classification though if they are PDFs or have tags like “Graphic Novel” or “Cookbook”. I’d appreciate any help figuring this out.

program:
val = field('#pagecount');
first_non_empty(
	cmp(val, 0, ' ', '', ''),
	cmp(val, 15, 'Flash Fiction', '', ''),
	cmp(val, 50, 'Short Story', '', ''),
	cmp(val, 100, 'Novelette', '', ''),
	cmp(val, 250, 'Novella', '', ''),
	cmp(val, 500, 'Short Novel', '', ''),
	cmp(val, 750, 'Long Novel', '', ''),	
	cmp(val, 1000, 'Tome', '', ''),
	'Toe Breaker');

5
1
Comments 1