View Single Post
Old 02-15-2023, 08:01 AM   #1
JJanssen
Member
JJanssen began at the beginning.
 
Posts: 16
Karma: 24
Join Date: Jun 2009
Device: Kindle Paperwhite 1
Question Advanced series_index formatting sanity check

I've been away from my Calibre for a While for Reasons that are not relevant here, but anyway, I'm starting to use it again.

I have mine set to email to Kindle Docs and I'm using a variant of the {series}{series_index:| - | - }{title} because... I think because I was masochistic nearly a decade ago frankly, but anyway, what it *does* is, for any given series, I add leading and trailing zeroes such that within the series the numbering is consistent (and sorts correctly on a naive sort), but I don't clutter up a rando trilogy with 001-003 if 1-3 is all thats needed. Oh, and also the fractions are only added on for the fractional books.

So how I accomplished this back in the day:
- Kindle plugboard goes out as {series}{#series_index_formatted:| - | - }{title}
- that column is built as program: finish_formatting(field('series_index'), field("#format_str"),'','')
- the format_str column is a text column and that was built with a manually run external script (that I did find somewhere on my hard drive, which was halfway a surprise) but that has stopped working at some point.

The script is python that runs via calibre-debug -e, and what it spits out (well, used to) is for instance:

- series with only 1-9: 01.0f (and 1-99 gets 02.0f)
- series with only a 1 and a 1.1: 01.0f and 03.1f respectively

etc.

Given that I want to accomplish this goal of getting what I consider properly formatted per-series indexes (in an automated fashion), is this even the way I'd go about it these days? Because if so, I need to figure out how to repair the python script, but if there's a Better Way, well, might as well make it better.
JJanssen is offline   Reply With Quote