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 03-09-2023, 02:09 AM   #1
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,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Finding partially read series

Using either the built-in search functions or a plugin (MCS?), is there a way to find series that have nonidentical metadata in a specific column?

I have a composite #readstatus column. I want to find series where all the books aren't either 'Read' or 'Unread.'

Thanks
ownedbycats is online now   Reply With Quote
Old 03-09-2023, 07:08 AM   #2
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You don't say if #readstatus can have values other than 'Read' or 'Unread'. I assume it can't. The templates below won't work if my assumption is wrong.

These two templates return 'Yes' if #readstatus has more than one value for a series, the empty string otherwise. The GPM template is probably easier for you to maintain. The Python template is much faster.

Edit: add comments to the template, and remove the trailing comma
Code:
program:
	globals(answers = '');
	if !answers then
# Get a list of series names
		series_names = book_values('series', 'id:true', ',', 1);
# Loop over the series names
		for series in series_names:
# Get all the values in the '#readstatus column
			values = book_values('#readstatus', 'series:="' & series & '"', ',', 1);
			if list_count(values, ',') > 1 then
# More than one value found. Store the series in the answers global for later use
				answers = answers & series & ','
			fi
		rof;
# remove the trailing comma
		answers = re(answers, ',$', '');
		set_globals(answers)
	fi;
	str_in_list(answers, ',', $series, 'Yes', '')
Edit: Fix bug where identical values were counted as unique
Code:
python:
def evaluate(book, context):
	db = context.db.new_api
	answer = context.globals.get('answer', None)
	if answer is None:
		answer = set()
		all_series = db.all_field_names('series')
		for series in all_series:
			series_id = db.get_item_id('series', series)
			books_in_series = db.books_for_field('series', series_id)
			vals = db.all_field_for('#readstatus', books_in_series)
			unique_vals = {v for v in vals.values()}
			if len(unique_vals) > 1:
				answer.add(series)
		context.globals['answer'] = answer
	return 'Yes' if book.series in answer else ''
The 'globals' stuff is there so the template computes the answer data once for the search instead of for every book.

Last edited by chaley; 03-09-2023 at 08:38 AM. Reason: add comments to the template, and remove the trailing comma
chaley is offline   Reply With Quote
Advert
Old 03-09-2023, 07:30 AM   #3
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,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
It does have other statuses; read, unread, currently reading, to be read, and undefined.
ownedbycats is online now   Reply With Quote
Old 03-09-2023, 07:30 AM   #4
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,628
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
So, I'm assuming this template would give you all the unfinished series.... I would like to use them in a search, not adding a composite column. How could I do that? Sorry, my searches are quite simple... and this can avoid me a function I've not that calculates some data for a series every time I add or read a book.
Terisa de morgan is offline   Reply With Quote
Old 03-09-2023, 07:32 AM   #5
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
It does have other statuses; read, unread, currently reading, to be read, and undefined.
What exactly is the rule? When should the template return 'Yes'?
chaley is offline   Reply With Quote
Advert
Old 03-09-2023, 07:44 AM   #6
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
So, I'm assuming this template would give you all the unfinished series.... I would like to use them in a search, not adding a composite column. How could I do that? Sorry, my searches are quite simple... and this can avoid me a function I've not that calculates some data for a series every time I add or read a book.
Use a "Template Search", which allows you to do more-or-less arbitrary things while searching. Your situation is exactly why I added it -- avoiding creating composite columns for one-off searches.

You get to Template Search using the advanced search button. Using the above python template as an example, the template search would be:
Attached Thumbnails
Click image for larger version

Name:	Clipboard01.jpg
Views:	86
Size:	69.0 KB
ID:	200213  
chaley is offline   Reply With Quote
Old 03-09-2023, 08:14 AM   #7
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,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
What exactly is the rule? When should the template return 'Yes'?
It pulls from my readstatus() template:

Code:
program:

	if $$#percentread >=#1 && $$#percentread <=#99
	then 'currentlyreading' 

	elif "To Be Read" in $#readinglist && $$#percentread ==#0
	then 'toberead' 

	elif $$#percentread >=#100
	then 'read' 

	elif $$#percentread == 'None'
	then 'undefined' 

	elif $$#percentread >=#0
	then 'unread' 

	fi
Code:
program:
	if readstatus()=='currentlyreading' then 'Currently Reading'
	elif readstatus()=='toberead' then 'To Be Read'
	elif readstatus()=='read' then 'Read'
	elif readstatus()=='unread' then 'Unread'
	elif readstatus()=='Undefined' then 'Undefined'	
	fi
I'd like to return "yes" when the books in the series don't match the same value.

For example, a series of three books:
All three books are 'unread' - false
The first two books are 'read', and the third 'unread' - true
The first book is 'read', the second is 'to be read', and the third 'unread' - true

Last edited by ownedbycats; 03-09-2023 at 08:19 AM.
ownedbycats is online now   Reply With Quote
Old 03-09-2023, 08:21 AM   #8
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I'd like to return "yes" when the books in the series have different values.
The above templates do that. They return 'Yes' when the list of values for books in a series contains one result. It doesn't matter what that result is, only that there is only one. For example, it will return 'Yes' when one book has 'Undefined' and another book has 'Unread'. If all books have the same value such as 'toberead' then the template returns ''.
chaley is offline   Reply With Quote
Old 03-09-2023, 08:25 AM   #9
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,628
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by chaley View Post
Use a "Template Search", which allows you to do more-or-less arbitrary things while searching. Your situation is exactly why I added it -- avoiding creating composite columns for one-off searches.

You get to Template Search using the advanced search button. Using the above python template as an example, the template search would be:
Thank you ,and good, because the python template is exactly what I understand
Terisa de morgan is offline   Reply With Quote
Old 03-09-2023, 08:34 AM   #10
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,973
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
It works Thank you
ownedbycats is online now   Reply With Quote
Old 03-09-2023, 02:11 PM   #11
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,628
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Thank you! It works perfectly with my column for reading status.
Terisa de morgan is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Series of Capitalized Words? enuddleyarbl ePub 5 02-12-2023 12:18 PM
Amazon partially fixed bug that did not read metadata darrenma Amazon Kindle 5 10-27-2022 03:08 AM
Finding What Books are Missing from a series Spuggyface Reading and Management 3 02-08-2017 08:06 PM
Need help finding a certain type of series - Help please! damican Reading Recommendations 31 02-21-2015 08:02 PM
Need help finding something new to read. darearkin Reading Recommendations 24 01-27-2012 09:58 AM


All times are GMT -4. The time now is 01:00 AM.


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