05-14-2017, 05:54 PM | #1 |
Junior Member
Posts: 9
Karma: 348
Join Date: May 2017
Device: Kindle Voyage
|
Metadata Plugboard Series Numbers
I've been using the Metadata Plugboard to include series information when I transfer books from my computer to my Kindle, but I have been unable to figure out how to get books with decimal places in the series information to sort properly because they lack the leading 0.
This is probably best shown by example, so...
This means of course that 2.50 sorts *after* both the 03 and the 10 because the leading 0 is missing. Is there any way to get the 2.50 to be 02.50 without making 03 and 10 into 03.00 and 10.00? Not all series have the decimal books, and putting decimals in every series would get cluttered. Thanks everyone. :) Edit: Solution given by chaley in post #7. Last edited by bttrflii; 05-16-2017 at 12:12 PM. |
05-14-2017, 06:16 PM | #2 | |
Grand Sorcerer
Posts: 6,208
Karma: 16534692
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
{series}{series_index:0>5.2f| |: }{title} |
|
05-14-2017, 11:09 PM | #3 |
Junior Member
Posts: 9
Karma: 348
Join Date: May 2017
Device: Kindle Voyage
|
Thank you, jackie_w, but unfortunately that turns the 03 and 10 numbers into 03.00 and 10.00, which I would really like to avoid. I'd like to have only the 2.50 change into 02.50 if possible.
|
05-15-2017, 01:32 AM | #4 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
You need the leading 0 for single digit indexes |
|
05-15-2017, 09:59 AM | #5 |
Junior Member
Posts: 9
Karma: 348
Join Date: May 2017
Device: Kindle Voyage
|
I can't quite figure out what you're trying to say. I *DO* want the leading zero, and I currently get a leading zero when the series number is a whole number. What I'm asking is how to get a leading zero in front of partial numbers as well, without adding three extra characters (a decimal and two zeroes) to all of the whole numbers.
|
05-15-2017, 08:50 PM | #6 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
5.2 means 5 places total 2 digits dot 2 digits if you need 3 digits to the left: 6.2 if you need 3 digits to the right: 6.3 BTW I use {series_index:0>5.2f|| - }{title} on my K4 (and I discovered the hard way ) -{series_index:0>5.2f|| - }{title} causes a reverse sort |
|
05-16-2017, 03:27 AM | #7 | |
Grand Sorcerer
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Make the column and use the following as the template: Code:
program: si = field('series_index'); format = contains(si, '\.', '{0:06.2f}', '{0:03d}'); format_number(si, format) |
|
05-16-2017, 12:10 PM | #8 | |
Junior Member
Posts: 9
Karma: 348
Join Date: May 2017
Device: Kindle Voyage
|
Quote:
Thank you SO MUCH, chaley!!! |
|
05-16-2017, 12:25 PM | #9 | |
Grand Sorcerer
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
A note, because I should write this somewhere ... While working on other calibre stuff today I made a change to the format_date function. The change will appear in calibre V3. Up to now the format_number template had to be enclosed in { } characters, meaning that format_number couldn't be used in Template Program Mode because the TPM template evaluator can't handle sub-templates. That is why I said you needed to use a General Program Mode template. The change is that if a format template does not contain a { character then it is now assumed to be a number format specification and is treated accordingly. This means that starting with calibre V3, the following will work, eliminating the need for the extra column. Code:
{series_index:'format_number($, contains($, '\.', '06.2f', '03d'))'} |
|
05-17-2017, 03:11 PM | #10 |
Junior Member
Posts: 9
Karma: 348
Join Date: May 2017
Device: Kindle Voyage
|
That is awesome news! I'm sure others who'd hoped to have more control will appreciate this as much as I do, and I'll be sure to simplify my plugboard once I have calibre v3 installed. :) Thank you once more.
|
06-02-2017, 12:27 AM | #11 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2012
Device: Kindle Paperwhite
|
So I am looking to do what the OP and sort series correctly with decimals. Currently I am using the following plugboard:
Code:
program:no_decimal = template('{series}{series_index:0>2s| | - }{title}');has_decimal = template('{series}{series_index:0>4.1f| | - }{title}');contains(field('series_index'),'\.',has_decimal,no_decimal) Series_Name 01 - Title Series_Name 02.1 - Title Series_Name 02.2 - Title Series_Name 02 - Title Series_Name 03 - Title Now this isn't a huge issue, at least they a grouped together, and not 10 books apart, but it is a minor annoyance. I thought I would give Post #7's solution a try and unfortunately, it still sorts in the same manor. Any advice? |
06-02-2017, 01:39 AM | #12 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
ASCII sort rules usually prevail The shorter string version ( without the .# )should be first I know (the hard way ) the Kindle treats a - before a number as a minus, so you get a descending order -5, -4,-3,-2.. |
|
06-03-2017, 12:21 AM | #13 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2012
Device: Kindle Paperwhite
|
Quote:
This issue is on the device (Paperwhite). If I plug the same template into a custom column, the sorting is done correctly. In regards to your comment about '-' preceding a number, that makes sense. However the '-', in this case, comes after the number so it should have no such effect. Would you suggest swapping out for a ':' to be safe? For what it's worth, when I used #7's fix, I used ':' and ended up with the same issue. I considered the possibility that the error arises from the fact that the whole number values aren't followed by '.0'. I can manually test this, but seems odd. Thoughts? |
|
06-03-2017, 10:37 AM | #14 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
{series_index:0>5.2f|| - }{title} Not optimal, but it fits on the screen |
|
01-18-2020, 09:20 PM | #15 | |
Member
Posts: 23
Karma: 10
Join Date: May 2012
Device: Kindle Oasis, Scribe, Paperwhite // Boox Palma
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with series numbering plugboard | Aliarides | Calibre | 40 | 12-30-2015 03:35 PM |
Need Help with PW2 Metadata Plugboard and author sort PLUS series name | drakebelisarius | Amazon Kindle | 3 | 02-26-2014 07:12 PM |
Metadata Plugboard for Series Number Reformatting | Victorious56 | Library Management | 4 | 05-08-2013 05:09 AM |
Plugboard "Metadata: Show series [series index] - title as title (Kindle)" | Deep Cover | Library Management | 6 | 11-30-2012 05:17 PM |
Metadata Plugboard - First Char of each word in Series | MikeP1212 | Calibre | 2 | 10-14-2010 06:14 PM |