View Single Post
Old 01-25-2025, 06:27 PM   #789
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 911
Karma: 810834
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by Comfy.n View Post
I liked this approach and now I have:

Code:
program: def do_field(field_name, icon, something, something2):
		return (if v = field(field_name) then icon & v  & something & something2 fi)
	fed;
out = '  💾 ';
fmts = list_sort(formats_sizes(), 0, ',') ;
for fmt_data in fmts:
fmt = sublist(fmt_data, 0, 1, ':');
size = sublist(fmt_data, 1, 2, ':');
str = if size ># 0 then strcat(fmt, ': ', human_readable(size), ' | ') else '' fi;
out=strcat(out, str)
rof;
if substr(out, -2, 0) == '| ' then
out = substr(out, 0, -3)
fi;
out

& strcat(
do_field('#li', '​ ✍️ '),
do_field('#fav', ' ⭐:'),
do_field('#pp', '​ 📈 ', ' pages') ,
do_field('#words', '​ 📈 ', ' words') ,
do_field('#ac', '​ 🟨 '),
do_field('#ot', '​ 🌱 '),
do_field('#tr', '​ 🌐'),
do_field('series', '​ ▶️ ', ' - ' , field('series_index'))
)
It was cool to figure out how to concatenate the pages, words and series info, by adding those extra 'somethings', though I suspect there's a simpler way. I've added #ot (original title) and #tr (translator) as I have populated the db with this info for some titles.


Very good idea !!!
dunhill is offline   Reply With Quote