Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 06-03-2025, 06:40 PM   #841
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: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Code:
program:	

subjects = $#subjects;
admintags = $#admintags;
existing_colls = $#kobocoll;

	new_colls = strcat(	
		if $#booktype=='Fanfiction' then 'Fanfiction,' fi,
		if '^Cozy Mystery$' inlist subjects then 'Cozy Mysteries,' fi,
		if '^Horses$' inlist subjects then 'Horses,' fi,
		if '(Juvenile|Young Adult)' inlist subjects then 'Juvenile & Young Adults,' fi,
		if '^(Fantasy|Paranormal|Science Fiction)$' inlist subjects && !'Star Trek' inlist subjects then 'Fantasy & Sci-Fi,' fi,
		if '^Star Trek$' inlist subjects then 'Star Trek,' fi,
		if 'Omnibus' in admintags then 'Omnibuses' fi,
	);
Line 12, can be done without the extra inlist?

Last edited by ownedbycats; 06-03-2025 at 06:46 PM.
ownedbycats is online now   Reply With Quote
Old 06-04-2025, 06:14 AM   #842
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,429
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Code:
program:	

subjects = $#subjects;
admintags = $#admintags;
existing_colls = $#kobocoll;

	new_colls = strcat(	
		if $#booktype=='Fanfiction' then 'Fanfiction,' fi,
		if '^Cozy Mystery$' inlist subjects then 'Cozy Mysteries,' fi,
		if '^Horses$' inlist subjects then 'Horses,' fi,
		if '(Juvenile|Young Adult)' inlist subjects then 'Juvenile & Young Adults,' fi,
		if '^(Fantasy|Paranormal|Science Fiction)$' inlist subjects && !'Star Trek' inlist subjects then 'Fantasy & Sci-Fi,' fi,
		if '^Star Trek$' inlist subjects then 'Star Trek,' fi,
		if 'Omnibus' in admintags then 'Omnibuses' fi,
	);
Line 12, can be done without the extra inlist?
Yes, it can be done but it is complicated and probably slower. It would be some combination of list_intersection and list_count. It could be done as a python template used as a function, something like
Code:
check_inlist_field(field, values required, values_not_allowed)
but I don't see a pressing need here.

You should use "inlist_field '#subjects'" instead of "inlist subjects".

I also suggest you use parentheses on line 12 to avoid any possibility of operator precidence being what you don't want. Example:
Code:
if ('^(Fantasy|Paranormal|Science Fiction)$' inlist_field '#subjects') && (!('Star Trek' inlist_field '#subjects')) then 'Fantasy & Sci-Fi,' fi,

Last edited by chaley; 06-04-2025 at 06:16 AM.
chaley is offline   Reply With Quote
Old 06-16-2025, 07:07 PM   #843
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: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I have this to display icons for formats, and an unknown icon if none are present:

Code:
program: 

formats = approximate_formats();

   strcat
   (
		if "azw3" inlist formats then 'formats_azw3.png:' fi,
		if "cbz" inlist formats then 'formats_cbz.png:' fi,	
		if "epub" inlist formats then 'formats_epub.png:' fi,
		if "html" inlist formats then 'formats_html.png:' fi,
		if "mobi" inlist formats then 'formats_mobi.png:' fi,
		if "paperbook" inlist formats then 'formats_paperbook.png:' fi,
		if "pdf" inlist formats then 'formats_pdf.png:' fi,	
		if "txt" inlist formats then 'formats_txt.png:' fi,	
		if "(overdrive|paperloan)" inlist formats then 'formats_overdrive.png:' fi,	

		if list_difference(formats, 'azw3, cbz, epub, html, mobi, paperbook, pdf, txt, overdrive, paperloan', ',') then 'formats_unknown.png' fi	
   )
Very repetitive. Except for paperloan, Is there a way to regex this to a single line, and would be any faster?
ownedbycats is online now   Reply With Quote
Old 06-16-2025, 07:39 PM   #844
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,712
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Maybe there's a way to use the png's in the ???\resources\images\mimetypes folder, where the image names are the format file types - e.g. epub.png, pdf.png etc.

BR
BetterRed is offline   Reply With Quote
Old 06-16-2025, 09:30 PM   #845
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: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Yeah, I copied most icons from there (except paperbook and overdrive).
ownedbycats is online now   Reply With Quote
Old 06-17-2025, 07:11 AM   #846
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,429
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
This isn't as repetitive, but is a bit harder to understand.
Code:
program: 
	def add_icon_name(res, fmt):
		return res & 'formats_' & fmt & '.png:'
	fed;

	result = '';
	formats = approximate_formats();
	formats_for_book = list_intersection('azw3, cbz, epub, html, mobi, paperbook, pdf, txt', formats, ',');
	for format in formats_for_book:
		result = add_icon_name(result, format)
	rof;
	if "(overdrive|paperloan)" inlist formats then result = add_icon_name(result, 'overdrive') fi;
	if list_difference(formats, formats_for_book & ',overdrive,paperloan', ',') then
		result = add_icon_name(result, 'unknown')
	fi;
	re(result, ':$', '')
chaley is offline   Reply With Quote
Old 06-23-2025, 09:56 AM   #847
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: 10,944
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Code:
{title_sort:'contains(t=uppercase(re($, '^\W*(\w).*$','\1')), '\d', '0-9', t)'}
In a column, this has the first letter of a title (0-9 are combined). An accented letter (É) displays separate than the standard one (E). Is there a way to merge them?

EDIT: Got it (not sure if transliterate should come before or after uppercase).
Code:
{title_sort:'contains(t=uppercase(transliterate(re($, '^\W*(\w).*$','\1'))), '\d', '0-9', t)'}

Last edited by ownedbycats; 06-23-2025 at 10:02 AM.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Library Management: various questions not worth their own thread ownedbycats Library Management 210 07-07-2025 08:06 PM
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates Boilerplate4U Development 13 07-07-2020 02:35 AM
Questions on Kobo [Interfered with another thread topic] spdavies Kobo Reader 8 10-12-2014 11:37 AM
[OLD Thread] Some questions before buying the fire. darthreader13 Kindle Fire 7 05-10-2013 09:19 PM
Thread management questions meme Feedback 6 01-31-2011 05:07 PM


All times are GMT -4. The time now is 08:54 PM.


MobileRead.com is a privately owned, operated and funded community.