View Single Post
Old 04-27-2023, 08:01 AM   #104
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,469
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Would it make sense to include an explicit extra_file_count()? I think its currently possible with existing list functions (forgot exactly).
I am not interested in adding a plethora of specific functions that are trivially implementable with existing functions.
Code:
program:
	list_count(extra_file_names(':'), ':')
or this Python template:
Code:
python:
def evaluate(book, context):
	from calibre.gui2.ui import get_gui
	extra_files = get_gui().current_db.new_api.list_extra_files(book.id, use_cache=True)
	return str(len(extra_files)) if extra_files else ''
Edit: The Python template will be faster, which might be important if this is used for something like column icons.

Last edited by chaley; 04-27-2023 at 08:08 AM.
chaley is offline   Reply With Quote