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 05-21-2022, 02:19 AM   #1
w00dent0p
Connoisseur
w00dent0p began at the beginning.
 
w00dent0p's Avatar
 
Posts: 59
Karma: 10
Join Date: Dec 2021
Location: Berkshire, UK
Device: Kobo Libra 2
Change in Series Index when saving books to disc

Hi,

I've recently changed laptops, so copied my Calibre library from one machine to the other. Now when using 'Save to disc' I've noticed a difference in the handling of series_index, which is now causing duplicates in my exported library. For example ...

Previous behaviour:
...\Books\Sanderson, Brandon\Stormlight Archive, The\02 Words of Radiance - Brandon Sanderson.epub
...\Books\Sanderson, Brandon\Stormlight Archive, The\2.50 Edgedancer - Brandon Sanderson.epub

Current behaviour:
...\Books\Sanderson, Brandon\Stormlight Archive, The\02 Words of Radiance - Brandon Sanderson.epub
...\Books\Sanderson, Brandon\Stormlight Archive, The\2.5 Edgedancer - Brandon Sanderson.epub

So the issue only affects books with a non-integer series_index. I don't know if this is a change in Calibre behaviour, or a change in laptop (was Win10, now Win11).

My save template is unchanged:

{author_sort}/{series}/{series_index:0>2s} {title} - {authors}

Any thoughts?

Thanks,
Nigel

Last edited by w00dent0p; 05-21-2022 at 02:22 AM.
w00dent0p is offline   Reply With Quote
Old 05-21-2022, 05:29 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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
There was a change on 19/Feb to strip trailing zeros from series indices. The change appeared in calibre V5.38. I strongly doubt that it will be changed back.

You have three choices:
  1. Revert back to calibre 5.37 or earlier. You will be stuck there.
  2. Rename the existing books to get rid of the trailing zero.
  3. Change to this template that formats the series_index differently depending on whether it is a float or an integer
  4. Code:
    {author_sort}/{series}/{series_index:'if floor($) != $ then format_number($, '0.2f') else $ fi'} {title} - {authors}
chaley is offline   Reply With Quote
Old 05-21-2022, 05:36 AM   #3
w00dent0p
Connoisseur
w00dent0p began at the beginning.
 
w00dent0p's Avatar
 
Posts: 59
Karma: 10
Join Date: Dec 2021
Location: Berkshire, UK
Device: Kobo Libra 2
Thanks, that explains it. I already went with choice 2.

Can you please clarify the template meaning a little more? Is there a way to achieve a consistent format across both float and integer? i.e. xx.x for both?
w00dent0p is offline   Reply With Quote
Old 05-21-2022, 05:45 AM   #4
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,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by w00dent0p View Post
Thanks, that explains it. I already went with choice 2.

Can you please clarify the template meaning a little more? Is there a way to achieve a consistent format across both float and integer? i.e. xx.x for both?
Sure. If you *know* that you want xx.x and never xx.xx or xx then this does it.
Code:
{author_sort}/{series}/{series_index:format_number(0.1f)} {title} - {authors}
The original template checked to see if the index was a float by comparing its value to its 'floor' (integer part). If they are not the same then if used format_number() to convert it using 2 digits after the decimal, otherwise it used it unchanged. The new template (above) always converts it to use 1 digit after the decimal point regardless of whether it is integer or float.

Also and FWIW: the first template uses Template Program Mode. The one in this post uses Single Function Mode. My personal preference is General Program Mode, but I didn't provide an example in that mode.
chaley is offline   Reply With Quote
Old 05-21-2022, 05:52 AM   #5
w00dent0p
Connoisseur
w00dent0p began at the beginning.
 
w00dent0p's Avatar
 
Posts: 59
Karma: 10
Join Date: Dec 2021
Location: Berkshire, UK
Device: Kobo Libra 2
Thanks again.

That seems to result in xx.x, except for x.x when the index is less than 10.

Any way to always get xx.x ? i.e. to pad with the leading zero when needed.
w00dent0p is offline   Reply With Quote
Old 05-21-2022, 05:53 AM   #6
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: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
I wish people would stop requesting these changes. This change and the search are two changes that would be best (IMHO) to go back to the way they were.
JSWolf is offline   Reply With Quote
Old 05-21-2022, 06:03 AM   #7
w00dent0p
Connoisseur
w00dent0p began at the beginning.
 
w00dent0p's Avatar
 
Posts: 59
Karma: 10
Join Date: Dec 2021
Location: Berkshire, UK
Device: Kobo Libra 2
I've removed {series} and {series_index} from my template.

Since this stuff is subject to change, I decided it's a bit too much of a faff to deal with the resulting duplicate files.
w00dent0p is offline   Reply With Quote
Old 05-21-2022, 07:33 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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by w00dent0p View Post
Thanks again.

That seems to result in xx.x, except for x.x when the index is less than 10.

Any way to always get xx.x ? i.e. to pad with the leading zero when needed.
Like this:
Code:
{author_sort}/{series}/{series_index:format_number(04.1f)} {title} - {authors}
Quote:
Originally Posted by w00dent0p View Post
I've removed {series} and {series_index} from my template.

Since this stuff is subject to change, I decided it's a bit too much of a faff to deal with the resulting duplicate files.
I don't see why it would change again, and in any event the template isolates you from such changes.
chaley is offline   Reply With Quote
Old 05-21-2022, 07:35 AM   #9
w00dent0p
Connoisseur
w00dent0p began at the beginning.
 
w00dent0p's Avatar
 
Posts: 59
Karma: 10
Join Date: Dec 2021
Location: Berkshire, UK
Device: Kobo Libra 2
Thanks very much !!
w00dent0p is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change series index number format sent to device? Skydog Library Management 6 01-20-2020 10:21 PM
Python - Saving Books to Disc amimichelle Library Management 0 03-16-2017 11:01 AM
Saving Books to Disc - Some Help Please? Alidai Library Management 1 10-28-2013 02:40 AM
Saving to disc wjt Library Management 5 03-24-2012 05:03 PM
Saving to Disc deddajay Library Management 2 01-15-2012 03:02 PM


All times are GMT -4. The time now is 10:53 PM.


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