03-03-2023, 12:44 AM | #16 |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2023
Device: Kindle Paperwhite
|
How do I save after all actions are done? It seems there is no "save" action and I have to save it manually by clicking the button. Which also make it useless with Action Chain when I try to batch process multiple book from main GUI, nothing is saved.
Thanks. |
03-05-2023, 03:28 AM | #17 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
When used with Actions Chains, it automatically saves all the changes. It also keeps a backup of the old file (there is a setting to turn this off).
|
Advert | |
|
03-06-2023, 04:50 PM | #18 | |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2023
Device: Kindle Paperwhite
|
Quote:
But the issue I have now is that the result is different when I run Action Chains from when I run Editor Chains. Even though the only step in Action Chains is calling the exact chain in Editor Chains. The chain is quite simple - Conver to epub3 - embed fonts - subset fonts - fix HTML - beautify all If I run Editor chains, everything is executed as expected. After the chain I run "fix HTML/beautify" from menu and nothing will be changed. But if I run Action Chains, fix HTML and beautify doesn't seem to work. Once it completes, I edit the book and run fix HTML/beautify from menu, there are still a lot changes. |
|
03-10-2023, 04:52 PM | #19 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
The difference between what happens when in editor mode and what happens in Action Chains, is caused by the fact the calibre parses html differently when in editor mode. When in editor mode, calibre will remove some meta tags, that are otherwise not deleted. I don't know the exact reasons for why calibre does this, but I trust that Kovid has done this for good reasons.
It is trivial (in terms of code) to change the plugin to have it perform exactly the same in both modes. But I don't know if this would break some other action or functionality of the plugin. What is not trivial, however, is repeating all the hours of testing that has gone into the plugin to ensure nothing else breaks because of this change, which is not something I am prepared to do. Anyway, The difference in output is not significant (some meta tags and whitespace) and does not affect the end result. The bottom line is that the html files are beautified and fixed in both modes. If you are bent on having them exactly the same, try the chain attached below, which deletes the culprit meta tags. If you are still not getting the result you want, there is nothing to be done as the changes required for this require huge amount of testing that I am not ready to do. Spoiler:
|
05-21-2023, 06:46 PM | #20 |
Enthusiast
Posts: 31
Karma: 63058
Join Date: Feb 2012
Device: Kobo Aura One
|
This is fantastic. I have created a reduce file size chain with subset embedded fonts, remove unused CSS, and compress pictures down to 50%.
From within the editor, it makes the changes, I save, and I can immediately see the reduction in filesize. When running from Action Chains, it runs and completes and does reduce the size as expected, but the change in filesize is not shown. Even closing and reopening Calibre does not show the change in size. I have to edit the book, add and remove a space to a single file and then save to see the results of the chain. |
Advert | |
|
05-22-2023, 06:27 AM | #21 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Version 0.8.7
|
05-22-2023, 03:06 PM | #22 |
Enthusiast
Posts: 31
Karma: 63058
Join Date: Feb 2012
Device: Kobo Aura One
|
|
08-29-2023, 04:21 PM | #23 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Version 0.8.9
This action allows you to run a command on files inside the book. To better illustrate this I will give an example of chain I made which uses ImageMagick convert command to convert jpg and png pictures to a lower quality jpg and changes the colorspace to gray. The action will run this command for the selected files, and replace them with the resulting files. Below is a screenshot of the configuration for this action. Notes:
Last edited by capink; 01-20-2024 at 03:26 PM. |
08-31-2023, 01:56 PM | #24 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
!! Congratulations!!
For me it will be very useful. But I have ImageMagick installed correctly (although my knowledge of its use is zero) on Windows 10. I have copied your screenshot as it is and the thing does not work. I'm guessing it has to do with {inputfile} and {outputfile}, and it would be great if you could tell me what to do. Thanks in advance. |
08-31-2023, 04:40 PM | #25 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
Unfortunately I cannot test on Windows. A quick search suggests that maybe the command on Windows should be:
Code:
magick convert path/to/input/image -quality 80 -colorspace gray /path/to/output/image If the command runs successfully on your machine, run it in Editor Chains and post the debug log. You can run the editor in debug mode using the following command: Code:
calibre-debug --edit-book Last edited by capink; 08-31-2023 at 06:15 PM. |
08-31-2023, 07:02 PM | #26 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Unfortunately it doesn't work with the new command either.
Attached (in case it is of any use) the debug log. Thanks again for the try. Spoiler:
|
08-31-2023, 07:42 PM | #27 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
That's a problem with running the command on Windows. I suggest you open the Windows command line (cmd) and run this command on a test image:
Code:
magick convert path/to/input/image -quality 80 -colorspace gray /path/to/output/image Once you get the command working on Windows command line (using cmd.exe), we would be able to investigate whatever problems arises with the plugin. Last edited by capink; 08-31-2023 at 08:16 PM. |
09-01-2023, 04:37 AM | #28 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Code:
C:\Users\JB>magick convert path/to/input/wizard.jpg -quality 80 -colorspace gray /path/to/output/wizard.jpg convert: unable to open image 'path/to/input/wizard.jpg': No such file or directory @ error/blob.c/OpenBlob/3569. convert: no images defined `/path/to/output/wizard.jpg' @ error/convert.c/ConvertImageCommand/3354. Code:
C:\Users\JB>magick convert wizard.jpg -quality 80 -colorspace gray wizard.jpg |
09-01-2023, 01:13 PM | #29 |
Wizard
Posts: 1,139
Karma: 1954142
Join Date: Aug 2015
Device: Kindle
|
both /path/to/input and /path/to/output are meant to be replaced with actual paths on your system. If you are doing this and the command is still producing errors, this would be some trouble with ImageMagick on Windows that I wouldn't be be to assist much with. Your best bet, as I said, would be the ImageMagick forums, because for the plugin to work with command, it must accept the full paths.
|
09-07-2023, 04:18 PM | #30 |
Junior Member
Posts: 6
Karma: 10
Join Date: May 2023
Device: Android
|
I'm getting the same issue too (Windows 11).
I have tried running clean-css cli with both directly and with a bat script I made that takes a css file as an input, and neither do anything. My error log shows the same thing, "Command error: Return code is 1 when running command for file: {insert file name here}" |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] EpubCheck | Doitsu | Plugins | 163 | 07-23-2024 09:07 AM |
[Editor Plugin] LanguageTool | Doitsu | Plugins | 17 | 04-20-2024 03:21 PM |
[Editor Plugin] - Enabling 'Customize plugin' dialog directly from the Editor | thiago.eec | Development | 7 | 01-09-2019 09:05 PM |
Sample Plugin for the Editor | DiapDealer | Editor | 77 | 12-10-2014 08:16 AM |
Editor plugin question | DiapDealer | Development | 2 | 07-28-2014 11:23 PM |