![]() |
#601 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Calibre Actions > Remove books > Remove files of a specific format.
Note: This step is interactive and will pop up a dialog asking you to choose the format you want to delete. Quote:
I am not really sure how to do this. Maybe there is an option in calibre that does this automatically. Someone else might be able to help as I don't personally use devices with calibre. Calibre Actions > Send to device > Send to main memory Single Field Action |
|
![]() |
![]() |
![]() |
#602 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Regenerate the cover - I assume they're using Generate Cover plugin. I actually have a chain to re-gen the cover + Polish Book, which would also cover Embed Metadata if they select the option.
The last one can be done with single-field edit. I highly suggest looking into the template language as it provides some extra flexibility. For "Send the eBook to the Kindle," do you use the Reading List plugin? If so, here's what I do. First I have a Send-to-Device list with these sync settings: Then I set up two actions. One is to send the book to the device directly. The other adds it to the send-to-device list. Then I can use conditions to select the correct action depending on whether or not the device is connected. |
![]() |
![]() |
Advert | |
|
![]() |
#603 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite, Kobo Libra 2
|
@ownedbycats You answered while I was answering capink
![]() My answer to capink is being checked by a moderator and my additional questions might overlap your answer. I do not use this plugin but I will have a look at the template language. I test and I will let you know. |
![]() |
![]() |
![]() |
#604 | |||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Quote:
Quote:
Code:
template = program: connected_device_name('main') datatype = text comparison = "=" condition value = your device name |
|||
![]() |
![]() |
![]() |
#605 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
I have a template single-field edit that checks for specific values in some custom columns and then adds values to my Kobo collection column based on them: Code:
program: g = field('#genres'); vl = field('#vls'); k = field('#kobocoll'); v = first_non_empty( list_contains(vl, ',', '^Loans$', 'Loans', ''), list_contains(g, ',', '^Fanfiction$', 'Fanfiction', ''), list_contains(g, ',', '^Horses$', 'Horses', ''), list_contains(g, ',', '^Cozy Mystery$', 'Cozy Mysteries', ''), list_contains(g, ',', '^(Fantasy|Science Fiction)$', 'Fantasy & Sci-Fi', ''), ); list_union(k, v, ',') Code:
program: d1 = format_date(today(),'iso'); d2 = $$#fanficupdated; status = $#fanficstatus; if and( status=='In-Progress', days_between(d1, d2) ># 730, ) then "Abandoned" elif and( status=='In-Progress', $#fanficerror, ) then "Abandoned" else status fi Last edited by ownedbycats; 07-07-2021 at 04:21 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#606 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite, Kobo Libra 2
|
Thank to both of you! The template language is definitely useful
![]() (I cannot see my first answer but since you both answered to it, I will assume you could see it.) @ownedbycats I do not use the Generate cover plugin either, I just want to generate the default cover using the Edit metadata menu. |
![]() |
![]() |
![]() |
#607 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I'm not sure if there's a way to do that via AC.
|
![]() |
![]() |
![]() |
#608 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
I have a chain that uses "copy to clipboard" using this template. Template tester gave me an error, but looking at it through the Action Chains UI it was okay except for double-slashes D:\\Documents\\My Books\\.
Code:
program: containing_folder() Code:
calibre, version 5.23.0 ERROR: Unhandled exception: <b>TypeError</b>:expected str, bytes or os.PathLike object, not NoneType calibre 5.23 [64bit] embedded-python: True is64bit: True Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', '', 'Multiprocessor Free') Interface language: None Successfully initialized third party plugins: DeDRM (7, 2, 1) && Action Chains (1, 9, 2) && Audit Log (1, 0, 16) && Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (2, 1, 0) && Comments Cleaner (1, 3, 2) && Count Pages (1, 11, 0) && Embed Comic Metadata (1, 6, 1) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (4, 3, 7) && Fantastic Fiction (1, 4, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 8) && Generate Cover (2, 0, 2) && GetFileName (0, 1, 1) && Goodreads (1, 5, 1) && Import List (1, 5, 6) && Job Spy (1, 0, 190) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 2) && Kobo Utilities (2, 14, 0) && KoboTouchExtended (3, 4, 4) && Library Codes (1, 0, 50) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 2) && Obok DeDRM (7, 2, 1) && Open With (1, 5, 13) && Overdrive Link (2, 45, 1) && Quality Check (1, 11, 2) && Reading List (1, 7, 6) && Search The Internet (1, 8, 1) && SmartEject (2, 3, 0) && Standard Ebooks (1, 0, 0) && Sum Column (0, 3, 1) && View Manager (1, 6, 1) && Walk Search History (1, 3, 2) && Overdrive Link* (2, 45, 1) Traceback (most recent call last): File "calibre_plugins.action_chains.action", line 400, in run_chain File "calibre_plugins.action_chains.chains", line 391, in run File "calibre_plugins.action_chains.chains", line 206, in _run_loop File "calibre_plugins.action_chains.chains", line 183, in _run_loop File "calibre_plugins.action_chains.actions.copy_to_clipboard", line 212, in run File "calibre_plugins.action_chains.common_utils", line 807, in get_file_path File "ntpath.py", line 341, in expandvars TypeError: expected str, bytes or os.PathLike object, not NoneType |
![]() |
![]() |
![]() |
#609 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
Quote:
Last edited by capink; 07-10-2021 at 01:46 AM. Reason: move beta to the first post |
|
![]() |
![]() |
![]() |
#610 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
The beta fixed it.
![]() |
![]() |
![]() |
![]() |
#611 | |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite, Kobo Libra 2
|
Hello,
This is a follow up of two points in a previous discussion in this thread. I wrote it, or at least I wrote a module which delete the epub format without further prompting, leaving only the AZW3 format I wanted. Should I post the code here if it can be useful to someone? Quote:
With this information, I wrote: Code:
from calibre.ebooks.covers import generate_cover from calibre.ebooks.metadata.meta import metadata_from_formats from calibre_plugins.action_chains.actions.base import ChainAction class CustomCover(ChainAction): # replace with the name of your action name = 'Custom cover' def run(self, gui, settings, chain): db = gui.current_db.new_api rows = gui.current_view().selectionModel().selectedRows() book_ids = [ gui.library_view.model().db.id(row.row()) for row in rows ] for book_id in book_ids: mi = metadata_from_formats(paths) cdata_before_generate = current_val current_val = generate_cover(mi) ![]() Thank you! |
|
![]() |
![]() |
![]() |
#612 | |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,982
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#613 | |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite, Kobo Libra 2
|
Custom module to delete EPUB format
Quote:
You can delete another format by changing the line "fmt = 'YourFormat'" Code:
from calibre.ebooks.metadata.meta import metadata_from_formats from calibre_plugins.action_chains.actions.base import ChainAction class DeleteEPUBFormat(ChainAction): name = 'Delete EPUB format' def run(self, gui, settings, chain): db = gui.current_db.new_api rows = gui.current_view().selectionModel().selectedRows() book_ids = [ gui.library_view.model().db.id(row.row()) for row in rows ] fmt = 'epub' for book_id in book_ids: gui.library_view.model().db.remove_format(book_id, fmt, index_is_id=True, notify=False) gui.library_view.model().refresh_ids([book_id]) gui.library_view.model().current_changed(gui.library_view.currentIndex(), gui.library_view.currentIndex()) gui.tags_view.recount_with_position_based_index() |
|
![]() |
![]() |
![]() |
#614 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
|
I still don't know what you are trying to do with this action that cannot be done with the custom action I posted. Also in the code you posted current_val is referenced before assignment.
|
![]() |
![]() |
![]() |
#615 | |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Jul 2021
Device: Kindle Paperwhite, Kobo Libra 2
|
Quote:
With the custom action you suggest, I have a cover I do not want in the ebook and I set this cover as the ebook cover. I need to generate the cover. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] Editor Chains | capink | Plugins | 106 | 06-17-2025 05:36 PM |
Action Chains Resources | capink | Plugins | 77 | 06-16-2025 12:45 PM |
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB | lrpirlet | Plugins | 2 | 08-18-2022 03:15 PM |
[GUI Plugin] Save Virtual Libraries To Column (GUI) | chaley | Plugins | 14 | 04-04-2021 05:25 AM |