![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 95
Karma: 5854
Join Date: Aug 2011
Device: none
|
![]()
Whenever Calibre saves ebooks to disk which contain : or , or ? in the title, these (and other) characters will be replaced by an underscore _.
There must be an option to set a substitute but where? I'd like to replace : with - e.g. "you and me: a memoir" = "you and me - a memoir" and , or ; with _ e.g. "you, he, me" = "you he me" At the moment I can only do it with search/replace in edit metadata or outside Calibre with an additional software. I can't find anything in tweaks and am not experienced enough to do it with plugboards or a regular expression in preferences-save to disk. I have to use 1.47 and no, I can not upgrade. However the principle of how to do it will most likely be the same regardless which version you use. |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The way to do it is to use a template. https://manual.calibre-ebook.com/template_lang.html
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Zealot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 143
Karma: 76596
Join Date: Feb 2015
Location: Portugal
Device: Kobo Aura HD
|
Done reading that tutorial but its hard for me to understand the code partes without a live example. My bad... so much to learn and I'm not a programmer!
Can someone paste me an example for replacing a : in title with - (for the save to disk template) Then I can play with it and find some other uses (as in removing punctuation marks form file name)! Update, giving a copy/paste ready example: Using re(pattern, replacement) (the details are in the quoted tutorial: https://manual.calibre-ebook.com/template_lang.html ) Actual behaviour: When a title field has a value with ":" (as in "Title: subtitle") the ":" would cause a filename with "_space" instead of the ":" as in the file name Code:
Title_ subtitle.pdf For that use this in "Save to disk" Template (for the title field part) Code:
{title:re(:, -)} Related topics with same question https://www.mobileread.com/forums/sh...d.php?t=263504 https://www.mobileread.com/forums/sh...d.php?t=169516 Last edited by Horus68; 09-28-2019 at 06:30 AM. |
![]() |
![]() |
![]() |
#4 |
Member
![]() Posts: 16
Karma: 10
Join Date: Oct 2020
Device: Kindle
|
In case anyone else finds this while searching for a way to fix the underscore problem.
Here is my solution for now, though I wonder if a plugin that does something similar couldn't be developed. If I ever take the time to learn how to write plugins for Calibre this will be the first one I tackle. I think a template wouldn't work because the part of the code that replaces the special characters is applied after the template?? If I'm wrong about this that would be great. Here is a script that you can run with the export directory path as an argument after exporting the files from Calibre and it will rename them based on the metadata in the opf file. If you want to improve on this and repost it that would be great. I'm sure there is a lot that could be improved. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Save to disk | arcegabriel | Calibre | 8 | 03-16-2018 08:47 PM |
Save to Disk | Dethmaul | Library Management | 2 | 09-03-2015 01:11 AM |
Save to Disk help | Dethmaul | Library Management | 1 | 05-01-2014 03:51 PM |
Save to Disc - Folder name - Period changes to Underscore | Gutenberg | Library Management | 4 | 09-17-2012 10:48 AM |
Save on disk | PhM | Calibre | 1 | 06-13-2011 12:43 PM |