Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-11-2025, 01:35 PM   #1486
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,359
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Quote:
Originally Posted by tkshorty View Post
Hi,



I have no experience with python, and I am looking for a module, that I can import as an event, that triggers every time you send an ebook to the device.

Secondly also one for when you remove a book from the device.



Target is, to automatically add / remove a tag (currentlyReading) from the books on the corresponding action.



I am currently using a workaround, where I made a chain for send/del, which I can manually select instaed of the normal buttons.



thanks in advance for any help.
Have you looked at the Reading List plugin? https://www.mobileread.com/forums/sh...d.php?t=134856

Sent from my Pixel 7a using Tapatalk
PeterT is offline   Reply With Quote
Old 04-11-2025, 01:42 PM   #1487
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,600
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by Comfy.n View Post
Found an issue when using Spanish as UI language:

The View (open book) action gives "Menu entry: View (plugin_name: View) cannot be found"

Attachment 215000

I've only recently started looking at how translation works in Calibre plugins, but I guess that would be a missing translation in es.po from:
Code:
#: /__w/calibre/calibre/src/calibre/gui2/actions/view.py:51
msgid "View"
msgstr "Mostrar"
Upon changing UI to Spanish, the View action will lose selection state:

Attachment 214999
I have to check if I've got the same translations (guilty as sin of editing them if I don't like them ), but it doesn't happen to me ("Mostrar" sticks if I select it).
Terisa de morgan is offline   Reply With Quote
Old 04-11-2025, 02:04 PM   #1488
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,605
Karma: 7511185
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by Terisa de morgan View Post
I have to check if I've got the same translations (guilty as sin of editing them if I don't like them ), but it doesn't happen to me ("Mostrar" sticks if I select it).
well, then this only happens when switching UI language and using an existing chain, I guess...

I have tested switching UI language to Italian and English and the validation error doesn't happen
Comfy.n is offline   Reply With Quote
Old 04-11-2025, 02:12 PM   #1489
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,600
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by Comfy.n View Post
well, then this only happens when switching UI language and using an existing chain, I guess...

I have tested switching UI language to Italian and English and the validation error doesn't happen
It looks like something get messed in the translation.
Terisa de morgan is offline   Reply With Quote
Old 04-11-2025, 02:40 PM   #1490
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,774
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I occasionally have trouble with validation on some items that change the menu name, e.g. Sync List and Sync List (1). If it's detecting by name perhaps?
ownedbycats is offline   Reply With Quote
Old 04-12-2025, 02:58 PM   #1491
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 875
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by Terisa de morgan View Post
It looks like something get messed in the translation.
Apparently there were changes in the plugin code. I'm offering to update the translation. I'm actually working on it, but I wanted to give you some peace of mind.

I leave in this zip the po and mo files with the translation into Spanish
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	95
Size:	87.5 KB
ID:	215007  
Attached Files
File Type: zip translations.zip (43.5 KB, 59 views)

Last edited by dunhill; 04-12-2025 at 06:23 PM.
dunhill is offline   Reply With Quote
Old 04-13-2025, 02:50 AM   #1492
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,600
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by dunhill View Post
Apparently there were changes in the plugin code. I'm offering to update the translation. I'm actually working on it, but I wanted to give you some peace of mind.

I leave in this zip the po and mo files with the translation into Spanish
Thank you very much for the files, I'll include them in my plugin. I guess capink will include them in a newer release.
Terisa de morgan is offline   Reply With Quote
Old 04-15-2025, 10:42 PM   #1493
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,774
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Is it possible to put a separator between two variants in a chains? Dont think so but want to check.

Last edited by ownedbycats; 04-15-2025 at 10:49 PM.
ownedbycats is offline   Reply With Quote
Old 05-15-2025, 10:57 AM   #1494
Nicolas.Laurent
Member
Nicolas.Laurent began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2016
Location: France
Device: PocketBook Touch Lux 2
Hi

Is there a way to duplicate a book with an Action chain module? My level of Python knowledge is clearly insufficient, and all my attempts have failed..
Nicolas.Laurent is offline   Reply With Quote
Old 05-17-2025, 05:43 PM   #1495
bluefish2020
Junior Member
bluefish2020 began at the beginning.
 
bluefish2020's Avatar
 
Posts: 1
Karma: 10
Join Date: Mar 2025
Device: kindle oasis
Duplicate Book module

Quote:
Originally Posted by Nicolas.Laurent View Post
Is there a way to duplicate a book with an Action chain module? My level of Python knowledge is clearly insufficient, and all my attempts have failed..
I looked at what the add_empty builtin does and this seems to work well:

Code:
import os

from calibre_plugins.action_chains.actions.base import ChainAction

class DuplicateBookAction(ChainAction):
    name = 'Duplicate Book'
    support_scopes = True

    # code adapted from calibre/gui2/actions/add.py:add_empty()
    def run(self, gui, settings, chain):
        db = gui.current_db
        selected_books = chain.scope().get_book_ids()
        
        ids, orig_fmts = [], []
        for book_id in selected_books:
            metadata = db.get_metadata(book_id, index_is_id=True, get_cover=True, cover_as_data=True)
            orig_fmts = tuple(db.new_api.format(book_id, fmt, as_path=True) for fmt in db.new_api.formats(book_id))
            new_book_id = db.import_book(metadata, orig_fmts)
            ids.append(new_book_id)
            
        self.refresh_gui(gui, len(selected_books))
        # entirely optional: select and mark the copies
        if ids:
            ids.reverse()
            gui.library_view.select_rows(ids)
            db.set_marked_ids({id: 'duplicate' for id in ids})
        # clean up temp files created by new_api.format()
        for path in orig_fmts:
            os.remove(path)                        

    def refresh_gui(self, gui, num):
        gui.library_view.model().books_added(num)
        gui.refresh_cover_browser()
        gui.tags_view.recount()
bluefish2020 is offline   Reply With Quote
Old 05-20-2025, 01:35 AM   #1496
Nicolas.Laurent
Member
Nicolas.Laurent began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Jun 2016
Location: France
Device: PocketBook Touch Lux 2
Thanks a lot, works perfectly!
Nicolas.Laurent is offline   Reply With Quote
Old 05-20-2025, 06:53 PM   #1497
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,774
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Chain Variant: Suppose I have chain withb 4 variants. I want to have 2 run a specific action, 2 to not. What do I set _variant_argument?
ownedbycats is offline   Reply With Quote
Old 05-22-2025, 04:54 AM   #1498
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,190
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Is it possible to put a separator between two variants in a chains? Dont think so but want to check.
No.

Quote:
Originally Posted by ownedbycats View Post
Chain Variant: Suppose I have chain withb 4 variants. I want to have 2 run a specific action, 2 to not. What do I set _variant_argument?
_variant_argument for the two chains that should not run the action should be 1 and 2. For chains that should run the action should be 3 and 4.

The condition on that particualr action should be:

Code:
template = program: globals(_variant_argument)
datatype = number
comparison = ">"
condition value = 2

Last edited by capink; 05-22-2025 at 04:58 AM.
capink is offline   Reply With Quote
Old 05-26-2025, 01:16 PM   #1499
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,774
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Additionally, instead of two separate SFEs with _variant_argument as a conditional, can _variant_argument be used in a SFE (templated)?

EDIT: It does. I set to null for one variant, and current date for another.

Last edited by ownedbycats; 05-26-2025 at 05:36 PM.
ownedbycats is offline   Reply With Quote
Old 05-26-2025, 06:33 PM   #1500
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,190
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Additionally, instead of two separate SFEs with _variant_argument as a conditional, can _variant_argument be used in a SFE (templated)?

EDIT: It does. I set to null for one variant, and current date for another.
That is actually one of the main reasons I did the chain variations. I have some chains the perform operations and then rate a book. So I wanted to have a submenu for these chains, with variations that look like this:

Code:
Do something and rate: ★
Do something and rate: ★★
Do something and rate: ★★★
Do something and rate: ★★★★
Do something and rate: ★★★★★

The template for the chain variations is like this:
Code:
program:
    text = 'Do something and rate: ';
    for rating in range(2,11,2):
        text = text & '★';
        add_chain_variant(text, rating, 'submenu name')
    rof

Now, you can use single field edit to set the rating based on the _variant_argument:
Code:
program:
    globals(_variant_argument)

Last edited by capink; 05-26-2025 at 06:40 PM.
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Action Chains Resources capink Plugins 69 05-22-2025 04:49 AM
[Editor Plugin] Editor Chains capink Plugins 94 07-03-2024 07:26 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


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


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