I use this template to create collections.
Code:
program:
globals(serial_number='N4181B1027108');
if serial_number == 'N4181B1027108' then
return list_join(
':@:',
list_re($#cbhtags, ',', '^(.*)$', 'CBH Tags: \1'), ',',
list_re($authors, '&', '(^.).*', 'Authors: \1'), '&')
fi;
if serial_number == 'N4181B5019336' then
return list_join(
':@:',
list_re($#dthtags, ',', '^(.*)$', 'DTH Tags: \1'), ',',
list_re($authors, '&', '(^.*)', 'Authors: \1'), '&')
fi
The problem: no collections are created even though the debug log says the template returned values. Instead I get the following error for all the collections.
Code:
category not added to book.device_collections []
I debugged the problem by copying one book to a new library, preserving structure, and setting the debugging title appropriately. After a few trials I found that the problem is caused by
create_collections returning false because nothing is in the collections attributes box. The fix: kobo.driver.py line 3681:
Code:
@property
def create_collections(self):
return (self.manage_collections and self.supports_bookshelves and self.get_pref('create_collections') and
(len(self.collections_columns) > 0 or self.use_collections_template))