View Single Post
Old 05-24-2023, 05:18 AM   #626
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,529
Karma: 8075744
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I'd like to check extra_file_names for a file called 'Alternate Cover' (any extension). If it exists, add an entry to the #admintags column. Referencing the column would be faster than referencing extra_file_names for column icons and the like.

Is there any improvements I can make to this?

Code:
program: 

alternatecover = if 'Alternate Cover' inlist extra_file_names(',') then 'cover:alternate' else '' fi;

list_union($#admintags, alternatecover, ',')
This version is faster, avoiding the inlist and avoiding the list_union if there is no alternate cover.
Code:
program: 
	if has_extra_files('^Alternate Cover$') then
		list_union($#admintags, 'cover:alternate', ',')
	else
		$#admintags
	fi
chaley is offline   Reply With Quote