View Single Post
Old 03-06-2023, 03:17 PM   #2
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I don't know where the attribute 'cache_api" is defined. Is it something you made?

In any event, here is a calibre python template that returns all the current series names.
Code:
python:
python:
def evaluate(book, context):
	series_names = context.db.new_api.all_field_names('series')
	return ', '.join(series_names)
Going from your example, I would use
Code:
	series_names = self.db.new_api.all_field_names('series')
But if you are looking for all the books for a given series then
Code:
	series_id = context.db.new_api.get_item_id('series', 'Bah')
	# should check for None
	series_books = context.db.new_api.books_for_field('series', series_id)
chaley is offline   Reply With Quote