![]() |
#1 |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
Series Index Number
I use Reading List and Calibre Companion (v5.4.4.19) to send the details of the books I want to read this year to my mobile. When reading a book in a series, I like to know whereabouts in the series the book fits, e.g. if I am reading The Head Case by Bill Rogers, I can tell it is book 2 in a series of 14 (see screenshot attached).
To do this I have created a custom column (Total Series) that I manually update with the number of the latest book I have in calibre. Whenever a new book in a series is released, I bulk edit all the books in that series. This then updates another custom column (Series Pos), which is sent to Calibre Companion. However, I wonder if the Total Series column could be automatically populated by calibre, perhaps by using Template/Search Template or a plug-in. My knowledge of templates is basic at best and would appreciate some help on this. I know calibre can already calculate the next index in a series when adding a new book and I have seen reference to “get_next_series_num_for” in the calibre support (https://manual.calibre-ebook.com/db_api.html), but I cannot figure out how to call the code from a custom column. Can anyone point me in the right direction, please? ![]() |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,190
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No templates can access data for only one book at a time. For what you want they would need to access the entire library to check what the largest index value for the series is. The way to automate this would be to create a calibre plugin that scanned the library and updated the custom column.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You might look at the Quality check Plugin: Check Metadata: Check Series Gaps.
This is a Log report (copy to clipboard)' You would need to parse it outside of Calibre and the import (Import List Plugin? ) (It does designate Last: # ) Code:
Series: Bookworm - Author: Christopher G. Nuttall - Last: #4 Missing#: 1,2 ![]() |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I don't understand exactly what you want to do. It seems you want to do something with the series index when a book is added to the library, specifically copying the maximum series index for a series to a custom column for all books in that series.
If I am right then you can do what you want using the Action chains plugin. You would add the new book(s), ensure their series information is correct, select the new book(s), then use an action chain that uses a python action to determine the highest series index for a selected book then copy that number to your "Total series" column in all the other books in the series. You could use an action chains event to set the series for new books but I think that would end in disaster. You can't guarantee for any given book that the next index is one higher then the last or even that the series is correct. Ask in the action chains thread for more help. |
![]() |
![]() |
![]() |
#5 | |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
Quote:
![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#7 |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
[QUOTE=chaley;4511328]I don't understand exactly what you want to do. It seems you want to do something with the series index when a book is added to the library, specifically copying the maximum series index for a series to a custom column for all books in that series.
If I am right then you can do what you want using the Action chains plugin. You would add the new book(s), ensure their series information is correct, select the new book(s), then use an action chain that uses a python action to determine the highest series index for a selected book then copy that number to your "Total series" column in all the other books in the series. Hi Chaley, that is exactly what I want to do, although it doesn't have to be at the time of adding a new book, I'd be happy to run a plug-in, or similar, every now and again to keep the information up-to-date. Appreciate you pointing me towards Action Chains ![]() |
![]() |
![]() |
![]() |
#8 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
![]() IMHO don't bother bloating your metadata with extra columns that may be wrong next random period. ![]() I added some of MY custom columns to the Quicview VIEW (red marks) to make deciding easier ![]() BTW Quickview can respect the current VL (not done here). #Split_series is for when they do bridge (and no PI or site is going to make this obvious) #Split off is when I used EPUB-Split PI to break up a Boxed set) #Done Read 1999 is a flag that I have split this item. All these customs are Manual data entry. There is no Auto fill . |
|
![]() |
![]() |
![]() |
#9 |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
[QUOTE=theducks;4511356]
IMHO don't bother bloating your metadata with extra columns that may be wrong next random period. I know, but sometimes I just can't help myself ![]() I added some of MY custom columns to the Quicview VIEW (red marks) to make deciding easier ![]() BTW Quickview can respect the current VL (not done here). Wasn't aware of Quickview, going to have a play with it ![]() |
![]() |
![]() |
![]() |
#10 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 866
Karma: 409968
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
I have a custom information column with this template, maybe you can adapt it and see if it works for you.
Code:
python: def evaluate(book, context): # Use the built-in template function to format the title and authors x = context.funcs.template('{Title} - {authors}') # Count the books in the series. First get the series name series = book.get('series') if series: # The book is in a series. Get the book count in that series db = context.db.new_api series_id = db.get_item_id('series', series) book_count = len(db.books_for_field('series', series_id)) # Add the number of books to the title - author string x = x + f' - From the series "{series}, which has {book_count} books {"s" if book_count > 1 else ""}' else: x = x + " - This book does not belong to a series" return x |
![]() |
![]() |
![]() |
#11 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Here is the converted template. It returns the maximum series index for the series of the book. Somehow the indenting was lost in @dunhill's post, which is corrected here. Code:
python: def evaluate(book, context): db = context.db.new_api # Count the books in the series. First get the series name series = book.get('series') if series: # The book is in a series. Get all the books in that series series_id = db.get_item_id('series', series, case_sensitive=True) books = db.books_for_field('series', series_id) # Get the highest series index max_dex = -9999 for b in books: ser = db.field_for('series_index', b) if ser > max_dex: max_dex = ser # Convert the max index to a string. x = str(int(max_dex) if max_dex.is_integer() else max_dex) else: x = '' return x Last edited by chaley; 05-10-2025 at 01:58 PM. Reason: Faster template |
|
![]() |
![]() |
![]() |
#12 |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
[QUOTE=dunhill;4511391]I have a custom information column with this template, maybe you can adapt it and see if it works for you.
That's great, thanks for the head start ![]() |
![]() |
![]() |
![]() |
#13 |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
![]() Can anyone tell me how you get the 'originally posted by ..." on your replies? |
![]() |
![]() |
![]() |
#14 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,903
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Your post had the Opening [quote] but appeared to be missing the closing one BTW I use the advanced message editor (by default. ) The Quote icon is the speech balloon usually found in comics) EDIT attached is the setting screen for the MR editor Last edited by theducks; 05-10-2025 at 02:36 PM. Reason: added image |
|
![]() |
![]() |
![]() |
#15 | |
Member
![]() Posts: 10
Karma: 10
Join Date: Apr 2025
Location: UK
Device: Kindle Paperwhite
|
Quote:
![]() ![]() ![]() ![]() ![]() This is fantastic, thank you so much. I added an empty book to the Jack Reacher series and calibre immediately populated the column for that book with the maximum index number. There was no lag (1,350 books) After a re-start all books in the series were updated. When I deleted the empty book and restarted calibre, the field automatically updated again ![]() Thank you to everyone who has help me with my query ![]() |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Missing Metadata tags for Series and Series Index? | JohnStaats | Sigil | 16 | 03-04-2025 02:05 AM |
how to view/filter library by series/series index | masp | Onyx Boox | 5 | 02-04-2021 11:39 AM |
How to change series index number format sent to device? | Skydog | Library Management | 6 | 01-20-2020 10:21 PM |
Series Index displayed as separate column from Series | Vortex | Library Management | 3 | 03-15-2015 08:39 PM |
Feature request: Ability to put a book in a series without an index number | lunixer | Calibre | 6 | 08-29-2011 11:37 AM |