Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 07-20-2022, 08:41 AM   #1
rolgiati
Groupie
rolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the endrolgiati knows the complete value of PI to the end
 
Posts: 166
Karma: 31650
Join Date: May 2011
Location: Asuncion (Paraguay)
Device: In the house, 3 K3 in use, 4 more in storage, and a K5 for testing
Selecting the highest Series_Index ?

I am trying to update my library, to check that I have the latest(s) book(s) in each of the Series I have been reading.

Is there a way, for all the Series in a library, to selet only the books with the highest Series_Index of each Series ?
rolgiati is offline   Reply With Quote
Old 07-20-2022, 09:09 AM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 75,012
Karma: 131375774
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Sort by series and then you can scroll to see which books are the highest number easily.
JSWolf is offline   Reply With Quote
Advert
Old 07-20-2022, 09:23 AM   #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: 11,849
Karma: 7035877
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by rolgiati View Post
I am trying to update my library, to check that I have the latest(s) book(s) in each of the Series I have been reading.

Is there a way, for all the Series in a library, to selet only the books with the highest Series_Index of each Series ?
You can do that with a template search that finds all series, finds the book(s) with highest index, then shows those books. This one works for me.

Code:
template:"""program:
	vals = globals(vals='');
	if !vals then
		all_series = book_values('series', 'series:true', ',', 0);
		for series in all_series:
			indices = book_values('series_index', 'series:="' & series & '"', ',', 0);
			first = 1;
			highest = 0;
			for index in indices:
				if first || index ># highest then highest = index; first = '' fi
			rof;
			vals = list_union(vals, series & ':' & highest, ',')
		rof;
		set_globals(vals)
	fi;
	if $series && $series_index ==# select(vals, $series) then '1' fi#@#:n:1"""
If you use the Advanced search builder in the search bar then the template is this:
Code:
program:
	vals = globals(vals='');
	if !vals then
		all_series = book_values('series', 'series:true', ',', 0);
		for series in all_series:
			indices = book_values('series_index', 'series:="' & series & '"', ',', 0);
			first = 1;
			highest = 0;
			for index in indices:
				if first || index ># highest then highest = index; first = '' fi
			rof;
			vals = list_union(vals, series & ':' & highest, ',')
		rof;
		set_globals(vals)
	fi;
	if $series && $series_index ==# select(vals, $series) then '1' fi
The Comparison type is Number and the Template value is 1
chaley is offline   Reply With Quote
Old 07-20-2022, 12:28 PM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,086
Karma: 57259778
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
The Quality check plugin looks for Gaps (thus it must find the highest present)
theducks is offline   Reply With Quote
Old 04-24-2023, 03:21 PM   #5
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,128
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
Since this is an old thread that predates the introduction of python templates by chaley, here is the python equivalent for the chaley's GPM template:

Code:
python:
def evaluate(book, context):
    vals = context.globals.get('highest_index_ids')
    if not vals:
        vals = context.globals['highest_index_ids'] = []
        db = context.db
        cats = db.new_api.get_categories(book_ids=None)
        all_series = [ t.name for t in cats['series'] ]
        for series in all_series:
            book_ids = db.data.search_getting_ids(f'series:"={series}"', '')
            indices = {}
            for book_id in book_ids:
                idx = db.new_api.field_for('series_index', book_id)
                indices[idx] = book_id
            vals.append(indices[max(indices.keys())])
    return '1' if book.id in vals else '0'
This should be a little faster.

Last edited by capink; 04-24-2023 at 04:27 PM.
capink is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why series_index is double and not int? Angelo.Mascaro Development 11 10-22-2019 06:00 AM
Series_Index search Sami Library Management 7 09-25-2015 10:54 AM
Plugboard, template series_index first? Truthowl Library Management 6 09-13-2014 12:34 PM
series_index manipulation kcz Library Management 15 10-15-2013 09:26 AM
Customize series_index value luoman Calibre 3 08-23-2013 04:11 AM


All times are GMT -4. The time now is 07:11 PM.


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