![]() |
#31 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
|
|
![]() |
![]() |
![]() |
#32 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
What version of calibre are you running, and on what OS? EDIT: There was a change in calibre 8.5.101 and later (e.g. 8.6) that might affect this. Last edited by chaley; 07-11-2025 at 04:03 AM. Reason: Info about release |
|
![]() |
![]() |
![]() |
#33 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 94
Karma: 118402
Join Date: Jul 2009
Device: Cybook Gen3
|
Quote:
Sorry, I don't get what you're doing with the hash. By design, hashes will stay the same if the file name changes. A file's hash is the hash of its contents. Metadata, such as file names, timestamps, and permissions, has no influence on the hash. see stackoverflow or stackexchange |
|
![]() |
![]() |
![]() |
#34 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,725
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Calibre has the option to embed current metadata into the format files that it exports… which includes title. So, if I export a format file now (i.e. an EPUB) and then change the title and re-export the EPUB the hash will change because the EPUB's content changed.
BR |
![]() |
![]() |
![]() |
#35 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 94
Karma: 118402
Join Date: Jul 2009
Device: Cybook Gen3
|
Quote:
I know, thanks. Embedding involves changing the content of the EPUB file, which has nothing to do with the file name, contrary to what the OP seems to think. Even if the file name (not the embedded title) is changed to '123.epub', it would still have the same hash. Therefore, 'Calibre truncates long names on Win10 with long paths enabled' is not related to the hash problem. |
|
![]() |
![]() |
![]() |
#36 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
|
|
![]() |
![]() |
![]() |
#37 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
Code:
Istsielieniie dukhovnykh boliez - Zhan-Klod Larshie.epub Now, the file (truncated same as before) is placed into the root directory of the device. |
|
![]() |
![]() |
![]() |
#38 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
|
|
![]() |
![]() |
![]() |
#39 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Quote:
![]() ![]() |
|
![]() |
![]() |
![]() |
#40 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
Also, the above code produces double extension such as
Code:
Istsielieniie dukhovnykh boliez - Zhan-Klod Larshie.epub.epub |
![]() |
![]() |
![]() |
#41 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
@kovidgoyal your help would be greatly appreciated. I have been hitting the wall for a very long time -
![]() ![]() |
![]() |
![]() |
![]() |
#42 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,355
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You were given a template that does it by chaley, not sure what more you want. It should be a trivial change in the template to both add an author folder and remove the file extension, or whatever else floats your boat. Good luck.
|
![]() |
![]() |
![]() |
#43 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,523
Karma: 78910202
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
I csn't help but think that you'd get more assistance from the koReader community; presumably others in that community also want to sync across multiple devices.
|
![]() |
![]() |
![]() |
#44 | ||||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Quote:
Quote:
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 three section, author, title, format.extension # We want to return author/format without the extension p = v['path'] r,f = os.path.split(p) format = os.path.splitext(f)[0] r,title = os.path.split(r) r,author = os.path.split(r) return '/'.join((author, format)) else: return 'title - author' saved in the library at Code:
"C:\CBH_Data\calibre.git\Library.test_small\A B\Unknown2 (foo) (1313)\Unknown2 (foo) - A B.epub" Code:
A B/Unknown2 (foo) - A B |
||||
![]() |
![]() |
![]() |
#45 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 68
Karma: 11226
Join Date: Mar 2022
Device: Kobo Libra 2, Aura H2O
|
@chaley Thank you! I kept struggling with the double extension issue. While adding the author directory to the destination was not difficult, for whatever reason I had to try several things to address the double extension thing. In the end the only solution which worked was to remove the extension from the filename before returning it, letting Calibre add it back during the transfer process. Here is the code which finally worked for me:
Code:
Python: def evaluate(book, context): import os fmt_metadata = book.get('format_metadata') # Get main author safely, fallback 'Unknown Author', and sanitize for filesystem author = book.get('authors', ['Unknown Author'])[0].replace('/', '_').replace('\\', '_') if fmt_metadata: for v in fmt_metadata.values(): # Extract only the filename with extension f = v['path'] filename = os.path.basename(f) # **FIX**: Remove the extension since Calibre will add it automatically filename_without_ext = os.path.splitext(filename)[0] # Compose path as: {Author}/{filename (WITHOUT extension)} return '/'.join([author, filename_without_ext]) else: # For fallback, also remove extension since Calibre will add it return '/'.join([author, 'title - author']) Last edited by edojan; 07-12-2025 at 02:13 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |