![]() |
#16 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Random number of characters in truncated file names
Quote:
![]() How can I have exactly the same file names between the main library in windows and file names copied to non-windows devices? E.g. if due to whatever limitation the book file in Calibre is 51 character long, then it would be transferred to connected devices without any changes. I would really appreciate your insight on how to resolve this. |
|
![]() |
![]() |
![]() |
#17 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,190
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
The file name sent to your ereader should be set from metadata depending on the template you use when saving. The name in the calibre library is not really relevant. Basically use the calibre library directory as a black box and stop peeking under it's skirts.
You may want to look at the location for your calibre library and move it to a location that has a shorter path. i.e. D:\Calibre\<library name>. OTOH, out of perhaps morbid curiosity, what is a hush number? You may want to disable updating metadata in the file when it is being sent from calibre to your Sage since that can and will modify the file hash. Depending on what file system you are using, other limitations may be present. If you are trying to use very long file paths, have you set FileSystem LongPathsEnabled to enabled in the registry and does the application have set longPathAware true in the application's manifest? |
![]() |
![]() |
![]() |
#18 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,025
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
And with long paths Backups will fail. Actually backups and copies can fail even with regular paths if the names of directories or files are too long.
|
![]() |
![]() |
![]() |
#19 | |||||
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Thanks for your response. Please see below.
Quote:
Quote:
Quote:
![]() ![]() Quote:
Quote:
I wish there was a setting "keep device file names the same as in Calibre library" This would be ideal |
|||||
![]() |
![]() |
![]() |
#20 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,750
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#21 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
On the other hand, you can use the format_paths() template function to get the current library file path for a book's formats and use that when sending to your device. Of course this won't help with long path names. |
|
![]() |
![]() |
![]() |
#22 | ||
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
Quote:
Code:
C:\VAULTS\ Code:
<dc:title>Исцеление духовных болезней</dc:title> Code:
C:\VAULTS\CalibVault\Zhan-Klod Larshie\Istsielieniie dukhovnykh boliezniei (517)\Istsielieniie dukhovnykh boliez - Zhan-Klod Larshie.epub Code:
E:\Zhan-Klod Larshie\Istsielieniie dukhovnykh boliezniei - Zhan-Klod Larshie.epub Code:
"Istsielieniie dukhovnykh boliez - Zhan-Klod Larshie.epub" Code:
"Istsielieniie dukhovnykh boliezniei - Zhan-Klod Larshie.epub" Last edited by edojan; 07-10-2025 at 03:01 PM. |
||
![]() |
![]() |
![]() |
#23 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#24 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
As I said, calibre chooses how to name files using whatever algorithm is in the release when the file is created. The algorithm is complex, taking into consideration lengths of the title, authors, path to library, and library ID. You cannot turn off calibre's actions when metadata changes. Others have tried to reproduce calibre's naming with templates. To my knowledge, during 15 years none have been successful.
Your only chance is to use the calibre-generated name, available via format_paths(). Or ![]() |
![]() |
![]() |
![]() |
#25 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
|
![]() |
![]() |
![]() |
#26 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
![]() |
![]() |
![]() |
#27 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
The formats_path() function has problems if authors contain a comma. I need to fix this in base calibre.
In the meantime, this python template returns the basename of the book file Code:
python: def evaluate(book, context): import os from calibre.library import current_library_path fmt_metadata = book.get('format_metadata') if fmt_metadata: for v in fmt_metadata.values(): # A calibre format name is roughly "author/title (id)/title - author.extension" # We want to return the last segment, stripping off the author and title # directory names and the extension, leaving just the basename of the book file f = v['path'] return f[f.rfind(os.sep)+1:f.rfind('.')] else: raise ValueError('Book "{}" has no formats'.format(book.title)) |
![]() |
![]() |
![]() |
#28 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
I really appreciate it. The problem is that I am not very technical. Would it be too much to ask for more detailed instructions? I have tried entering the code in the template editor, but it produces an error. What steps am I missing? |
|
![]() |
![]() |
![]() |
#29 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
here is the screenshot
|
![]() |
![]() |
![]() |
#30 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
That error is harmless, caused by the template dialog not having a real book to work with. It will work when it us run "for real" -- when sending to the device.
This version removes the error. Code:
python: def evaluate(book, context): import os from calibre.library import current_library_path fmt_metadata = book.get('format_metadata') if fmt_metadata: for v in fmt_metadata.values(): # A calibre format name is roughly "author/title (id)/title - author.extension" # We want to return the last segment, stripping off the author and title # directory names and the extension, leaving just the basename of the book file f = v['path'] return f[f.rfind(os.sep)+1:f.rfind('.')] else: return 'title - author' |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with Calibre's folder structure and long names in Windows | crixtiano | Calibre | 1 | 07-28-2017 02:05 PM |
Calibre taking a long, long time to update metadata on sony prs650 | hydin | Calibre | 5 | 06-05-2012 12:21 AM |
Is there anything in Calibre that can fix long file names automatically? | dmunson | Calibre | 4 | 02-05-2012 06:12 PM |
File Names to long? | JTAL604622 | Calibre | 5 | 08-31-2011 03:21 AM |
Files with long names? | cmhsieh54 | iRex | 0 | 08-05-2009 12:43 PM |