Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 12-25-2025, 08:14 AM   #121
nqk
Fanatic
nqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beautynqk does all things with Zen-like beauty
 
Posts: 597
Karma: 32228
Join Date: Feb 2012
Device: Onyx Boox Leaf
This is a great Christmas gift for me. Thank you very much.
nqk is offline   Reply With Quote
Old 04-11-2026, 09:00 AM   #122
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 150
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
I have been using some simple editor chains for some time now. Some search&replace items. That works well, and saves me time (thanks). But I would like to add some actions that only work on the opf file eg remove page-map. Is this possible or not? My knowledge of editor chains is still in its infancy. And I did not see any posts that clearly indicate this possibility.
Capricorn is offline   Reply With Quote
Old 04-11-2026, 11:01 AM   #123
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,344
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Capricorn View Post
I have been using some simple editor chains for some time now. Some search&replace items. That works well, and saves me time (thanks). But I would like to add some actions that only work on the opf file eg remove page-map. Is this possible or not? My knowledge of editor chains is still in its infancy. And I did not see any posts that clearly indicate this possibility.
Yes, you can achieve this using filename filters. See the example below: it searches only in the OPF and removes the <tours> element.
Attached Thumbnails
Click image for larger version

Name:	filters.png
Views:	57
Size:	19.4 KB
ID:	222454  
thiago.eec is offline   Reply With Quote
Old 04-14-2026, 02:13 AM   #124
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 150
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
Oh man....that is so cool. I did not know this fuctionality was there.
Thank you.
Capricorn is offline   Reply With Quote
Old 04-14-2026, 06:35 AM   #125
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 150
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
Thiago, In Post #99 you provide code to solve invaild IDs. That is something I would like to automate too, but how does this code work? I have no clue as to the steps needed to do so? I have read your post and the ones before and after, but I am still clueless. My knowledge is definitely not up to scratch. Any chance as to a step by step explanation how to do this? Would be much appreciated. Thanks in advance.
Capricorn is offline   Reply With Quote
Old 04-15-2026, 08:25 AM   #126
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,344
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Capricorn View Post
Thiago, In Post #99 you provide code to solve invaild IDs. That is something I would like to automate too, but how does this code work? I have no clue as to the steps needed to do so? I have read your post and the ones before and after, but I am still clueless. My knowledge is definitely not up to scratch. Any chance as to a step by step explanation how to do this? Would be much appreciated. Thanks in advance.
First you need to create the Module via Manage Modules > Create > Replace the existing text by this:

Spoiler:

Code:
from qt.core import (Qt, QApplication)

from calibre.ebooks.oeb.polish.check import parsing
from calibre.ebooks.oeb.polish.check.main import fix_errors

from calibre_plugins.editor_chains.actions.base import EditorAction

class ReplaceIDs(EditorAction):

    name = 'Replace IDs'
    headless = True

    def run(self, chain, settings, *args, **kwargs):
        container = chain.current_container
        QApplication.setOverrideCursor(Qt.WaitCursor)
        QApplication.processEvents()
        errors = parsing.check_ids(container)
        changed = fix_errors(container, errors)
        QApplication.restoreOverrideCursor()


Then, you need to create the chain, via Add/Modify Chains > Plus sign (+) > Choose a name > Gear icon (Settings) > You can choose an icon or not > Plus sign (+) > Select the new line > Double click in the Action field > User actions > Replace IDs > Ok.

Now, the new action will appear as option in the main menu. You can also use it as part of more complex chain, like the one you asked about before, doing search and replace.

Last edited by thiago.eec; 04-15-2026 at 08:28 AM.
thiago.eec is offline   Reply With Quote
Old 04-16-2026, 01:52 PM   #127
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 150
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
A very big thank you for posting this.
So the "Manage Modules" actually allows to add new code to the plugin. I have always wondered why it was there.
It is now working for me. One item less to manually do.

Capricorn is offline   Reply With Quote
Old 04-23-2026, 09:36 AM   #128
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 150
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
Thiago, In post 99 you have several zip files attached. One of them is "clean up.zip". On looking at it, I see a json file that contains interesting stuff I would like to automate too. I tried to add it to my Manage Modules in editor chains but I get the error message some stuff is missing. Hence I assume it is not code for a module in editor chains. But the question is then: how do I add this to the editor chain? Or are these all search & replace statements? And how would I add it to my saved search & replace statements? Do I need to merge it with some calibre json file?
Capricorn is offline   Reply With Quote
Old 04-23-2026, 10:06 AM   #129
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,344
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Capricorn View Post
Thiago, In post 99 you have several zip files attached. One of them is "clean up.zip". On looking at it, I see a json file that contains interesting stuff I would like to automate too. I tried to add it to my Manage Modules in editor chains but I get the error message some stuff is missing. Hence I assume it is not code for a module in editor chains. But the question is then: how do I add this to the editor chain? Or are these all search & replace statements? And how would I add it to my saved search & replace statements? Do I need to merge it with some calibre json file?
There are three different kind of code posted there:

1) Modules: they were posted inside the spoiler tag; click 'show' to view the code; add them to your modules. Some of those are used in the 'Cleanup' chain, so if not present the chain will fail. Modules are not chains, so they can't be used directly. You neeed to create a chain and configure it to use the respective module (like the 'Replace IDs' chain).

2) Regex function: there is only one posted. This is used to find <img> tags missing the alt attribute. To use it in the chain, add this function to the editor first: open the search tool (CTRL+F) and change mode to Regex Function; then click on 'Create/edit'; replace the content with the provided code; give this function a name (it will be used in the 'Cleanup' chain).

3) ZIP files: those are the chain files. You can import then directly via Add/modify Chains > Right click in the table > Import. After you add the 'Cleanup' chain, click in the gear icon. You can remove actions you don't need and add your own search/replace actions. The missing 'alt' action needs to be configured, pointing to your Regex function created in step 2.

I hope this covers everything.
thiago.eec is offline   Reply With Quote
Old 04-24-2026, 06:22 AM   #130
dewd
Connoisseur
dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.dewd ought to be getting tired of karma fortunes by now.
 
Posts: 63
Karma: 1231814
Join Date: Nov 2017
Device: Kobo Libra Colour, Kindle Voyage(s)
When running using Action Chains, this (optionally) creates a backup. What is the best way to restore this backup if needed?
dewd is offline   Reply With Quote
Old 04-25-2026, 02:08 PM   #131
slimcat
Enthusiast
slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'slimcat can spell AND pronounce 'liseuse.'
 
slimcat's Avatar
 
Posts: 35
Karma: 39964
Join Date: May 2025
Device: Kindle PW, iPad
Restoring from EC_BACKUP

Quote:
Originally Posted by dewd View Post
When running using Action Chains, this (optionally) creates a backup. What is the best way to restore this backup if needed?
I just had to restore ~1000 epubs after Calibre crashed in the middle of an Action Chain run on my whole library, so I just had to figure this out. The EC_BACKUP is just a copy of the original EPUB saved with a different format name (if you save the backup to disk and then change the ec_backup file extension back to epub you'll have a working epub copy of your backup).

Not sure if there's a better/easier way to restore the backup within Calibre, but the way I ended up doing it was with an Action Chain:

Action: Save/Restore Formats
Settings:
- Source format: ec_backup
- Destination format: epub

Check "Confirm overwriting existing format confirmation dialog" if you want Calibre to ask before replacing any existing EPUBs, otherwise they're silently overwritten. If you want the backup to be automatically deleted after the restore, check "Remove source format after copying."

I've attached the Action Chain I used. It made it super easy to restore everything.

On a related note, something I only caught shortly before this whole thing happened: if you're running a chain with multiple Editor Chain actions in it and want a backup copy of the EPUB before anything is changed, only check the backup option on the first Editor Chain. Backup is selected by default on each Editor Chain action, so you have to remember to uncheck it on the steps after the 1st one.
Attached Thumbnails
Click image for larger version

Name:	save:restore action chain settings.png
Views:	21
Size:	249.3 KB
ID:	222866  
Attached Files
File Type: zip action-chain-restore-from-ec-backup.zip (428 Bytes, 9 views)
slimcat is offline   Reply With Quote
Old 04-26-2026, 05:33 AM   #132
Capricorn
Belgian Pommes Frites
Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.Capricorn turned on, tuned in, and dropped out.
 
Posts: 150
Karma: 35038
Join Date: Jan 2012
Device: Pocketbook Touch HD
Quote:
Originally Posted by thiago.eec View Post
There are three different kind of code posted there:

1) Modules: they were posted inside the spoiler tag; click 'show' to view the code; add them to your modules. Some of those are used in the 'Cleanup' chain, so if not present the chain will fail. Modules are not chains, so they can't be used directly. You neeed to create a chain and configure it to use the respective module (like the 'Replace IDs' chain).

2) Regex function: there is only one posted. This is used to find <img> tags missing the alt attribute. To use it in the chain, add this function to the editor first: open the search tool (CTRL+F) and change mode to Regex Function; then click on 'Create/edit'; replace the content with the provided code; give this function a name (it will be used in the 'Cleanup' chain).

3) ZIP files: those are the chain files. You can import then directly via Add/modify Chains > Right click in the table > Import. After you add the 'Cleanup' chain, click in the gear icon. You can remove actions you don't need and add your own search/replace actions. The missing 'alt' action needs to be configured, pointing to your Regex function created in step 2.

I hope this covers everything.
Ah..that clears up a lot of confusion in my brain. And I did not even know I could import those chain files.
Capricorn is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] EpubCheck Doitsu Plugins 230 04-10-2026 03:19 AM
[Editor Plugin] LanguageTool Doitsu Plugins 17 04-20-2024 02:21 PM
[Editor Plugin] - Enabling 'Customize plugin' dialog directly from the Editor thiago.eec Development 7 01-09-2019 08:05 PM
Sample Plugin for the Editor DiapDealer Editor 77 12-10-2014 07:16 AM
Editor plugin question DiapDealer Development 2 07-28-2014 10:23 PM


All times are GMT -4. The time now is 03:03 AM.


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