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 07-05-2023, 12:49 PM   #1
chicleeblair
Connoisseur
chicleeblair began at the beginning.
 
Posts: 97
Karma: 10
Join Date: Sep 2018
Device: iPad mini
Composite Two questions: Column for Certain Tags & Chapter Numbers

Hi,

I’m trying to clean up my library, specifically my tags, so that I can use them as shelves on BookFusion (and also so they’re just more easily navigable.) I have questions:

1. How do you build a composite column that populates with certain tags? For instance, if a book has the tags “Young Adult,” “Fiction” and “LGBT+” the new column would show “Young Adult” and “LGBT+”

2. Similar to the above, if I have books that have hierarchal tags like "Young Adult: Contemporary” and “Young Adult: Sci-Fi” can I limit the composite column to only show “Young Adult?”

I know I can do all of this with VL and saved searches, but if there’s a way to do with with templates I’d like to figure that out.

3. (Unrelated) Is there a way to populate a custom column with the number of chapters in an ePub? (One that’s not a fanfic).
chicleeblair is offline   Reply With Quote
Old 07-05-2023, 04:02 PM   #2
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,932
Karma: 74999999
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
https://manual.calibre-ebook.com/template_lang.html

In particular, check out the various list functions. For #1, list_difference() can remove entries. Regexes are helpful here.

If it helps to see examples, here's an old version of my #subjects composite.

Code:
program:

tags = $tags;

	if 
		'^(Fiction|Nonfiction|Magazines & Publications)' in $#booktype 
	then 
## Split tags or return an empty
		split_tags = re(tags, '\.', ',') 
	else
		split_tags = ''
	fi;

## Removing a few unwanteds and sorting
	cleaned_tags = list_sort(list_difference(
		split_tags,
		'[Cleanup], Fiction, Nonfiction, Magazines & Publications, Cultures & Regions, Topics',
		','), 0, ',');

## Add 'Omnibus' if applicable
	if 
		'omnibus' 
	in 
		$#admintags 
	then 
		cleaned_tags  = 'Omnibus' & if cleaned_tags then ', ' & cleaned_tags fi
	fi;

	cleaned_tags

For #3, there really isn't a way to automatically count chapters and any method to do so would probably be fairly unreliable. I use 'Edit ToC' (a bit faster than opening the book), check there, and then manually input.

Last edited by ownedbycats; 07-05-2023 at 04:07 PM.
ownedbycats is offline   Reply With Quote
Advert
Old 07-05-2023, 05:09 PM   #3
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,416
Karma: 8012664
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by chicleeblair View Post
Hi,

2. Similar to the above, if I have books that have hierarchal tags like "Young Adult: Contemporary” and “Young Adult: Sci-Fi” can I limit the composite column to only show “Young Adult?”
If you are really using a colon as your hierarchical separator then life is more difficult. These tags aren't hierarchical in calibre. You must break them apart yourself using re() etc.

See this tutorial for how calibre supports hierarchical tags.

If instead you are using a period as the hierarchical separator then see the subitems() function.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Feature?/Help request: Sorting composite column by a different column's value isarl Library Management 15 04-26-2023 05:58 AM
Help with a composite column ownedbycats Library Management 2 07-08-2020 10:06 AM
Need help with composite column BookJunkieLI Library Management 2 07-03-2019 11:42 AM
Composite Column BetterRed Calibre 12 09-01-2013 04:58 AM
page numbers & chapter titles yJan ePub 8 10-04-2012 03:42 PM


All times are GMT -4. The time now is 05:45 AM.


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