View Single Post
Old 03-27-2025, 12:45 PM   #221
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,027
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by JSWolf View Post
So are those books where you aren't continuing the series going to be deleted?
Calibre, I removed the abandoned series. I like to keep them otherwise though. I have saved search for them.

Spoiler:
This stored template, series_multibook(), can find series with multiple book.

Code:
python:
def evaluate(book, context):
	# Return True ('yes') if the value in 'field' is used by more than 'test_count' books.
	# This template only works with single value fields such as Series, Publisher, and enumerations
	field = 'series'
	test_count = 1

	db = context.db.new_api
	id_map = context.globals.get('id_map')
	if id_map is None:
		context.globals['id_map'] = id_map = db.get_item_name_map(field)
		context.globals['item_book_count'] = db.get_usage_count_by_id(field)
	item_book_count = context.globals['item_book_count']

	item_id = id_map.get(book.get(field))
	if item_id is None or item_book_count.get(item_id, 0) <= test_count:
		return ''
	return 'yes'
This saved search then finds them:

Code:
NOT ( template:"""program: series_multibook()#@#:t:yes""" )
ownedbycats is offline   Reply With Quote