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-28-2022, 02:42 AM   #841
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,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
I have been having some personal issues lately, which means I will not be able to give much time to development of this — and other — plugins, at least for the next few months.

I am sorry for the people who have been asking questions and not getting any reply for me, hope you understand.
capink is offline   Reply With Quote
Old 04-28-2022, 02:42 AM   #842
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,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Question: Is there an option to output the results of a template to a dialog box? A bit more convenient than running a saved template in the tester.
That would be the formulas action.
capink is offline   Reply With Quote
Advert
Old 04-28-2022, 02:44 AM   #843
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,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Is there a way to validate all the chains at once without running them, or otherwise check for invalid Calibre actions? One of my plugins changed some strings so I'd like to check which chains need fixing.
That is a good idea for a new action. Will look at this as soon as I have the time.
capink is offline   Reply With Quote
Old 04-28-2022, 02:45 AM   #844
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,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
@capink: could you take a look at the View Manager thread starting here? The discussion is about delays when clicking on VL tabs. Clicking on a tab triggers a chain that uses the View Manager. It seems to call save_state *many* times (see the log in this post).

I think it would be best if you reply on the view manager thread.
Will look at this as soon as I have the time. Sorry for the inconvenience and late reply.
capink is offline   Reply With Quote
Old 04-28-2022, 02:50 AM   #845
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,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by tamaracks View Post
I've been using Action Chains a lot for the purpose of marking an action done in the metadata after doing it. But I can't achieve this with Modify EPUB, at least not with the accuracy I'd wish, because of the way that it works. The jobs run asynchronously, and you have to click on a prompt at the end in order to replace the EPUB file.
I have not used the modify epub plugin before. If it is using jobs you can actually wait for them to finish, by checking the option in the attached screenshot (in Calibre Actions settings).
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	60
Size:	6.1 KB
ID:	193486  
capink is offline   Reply With Quote
Advert
Old 04-29-2022, 11:29 PM   #846
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: 8,639
Karma: 61234567
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I was worried about the lack of posts. Hope things get better soon.
ownedbycats is online now   Reply With Quote
Old 04-30-2022, 12:07 AM   #847
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by tamaracks View Post
I've been using Action Chains a lot for the purpose of marking an action done in the metadata after doing it. But I can't achieve this with Modify EPUB, at least not with the accuracy I'd wish, because of the way that it works. The jobs run asynchronously, and you have to click on a prompt at the end in order to replace the EPUB file.
You could go into Preferences and customize the Modify Epub plugin to remove the checkmark from Prompt to save epubs.
DNSB is offline   Reply With Quote
Old 05-09-2022, 10:03 AM   #848
tamaracks
Connoisseur
tamaracks began at the beginning.
 
tamaracks's Avatar
 
Posts: 53
Karma: 10
Join Date: Jun 2021
Device: Onyx Boox Nova3
Quote:
Originally Posted by DNSB View Post
You could go into Preferences and customize the Modify Epub plugin to remove the checkmark from Prompt to save epubs.

I… never noticed that was an option, ha.
tamaracks is offline   Reply With Quote
Old 05-09-2022, 10:47 AM   #849
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by tamaracks View Post
I… never noticed that was an option, ha.
It was not there in the initial release.
Like many, we tend to set things up our way and just use it from then on.
As a regular (and a forum mod who had to do the updated notes when the original creator was not the updater) , I read a lot of posts, so I saw that features request and addition post.
theducks is offline   Reply With Quote
Old 05-10-2022, 07:14 AM   #850
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
Hey, a make a module.
The purpose of this module is to update the title and/or author sorting key, like the options in the Bulk Metadata dialog, options that are unavailable via Action Chains (I won't open the huge Bulk Metadata dialog just to check the same 2 options everytime => go on to make a non-interactive module).

I remember you had created a thread to reference different user modules (and other event managers), but I couldn't find it.
If it exists, it would be nice to have an explicit link in the description (so that we can look for it before breaking our heads to do things ourselves, especially if we don't understand anything in code)

Here is the code of the module:
EDIT: code moved into the dedicated thread

Last edited by un_pogaz; 05-10-2022 at 04:25 PM.
un_pogaz is offline   Reply With Quote
Old 05-10-2022, 12:46 PM   #851
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,234
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by un_pogaz View Post
Hey, a make a module.
The purpose of this module is to update the title and/or author sorting key, like the options in the Bulk Metadata dialog, options that are unavailable via Action Chains (I won't open the huge Bulk Metadata dialog just to check the same 2 options everytime=> go on to make a non-interactive module).
Thank you for the module. I guess you were looking for something like this, that it's included in the first post. I don't know if you were talking about something different.
Terisa de morgan is offline   Reply With Quote
Old 05-10-2022, 04:05 PM   #852
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
That's it! Thanks.
I was searching with the term "module" (not script), that's why I couldn't find it.
un_pogaz is offline   Reply With Quote
Old 05-10-2022, 04:34 PM   #853
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,234
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by un_pogaz View Post
That's it! Thanks.
I was searching with the term "module" (not script), that's why I couldn't find it.
Thank you for your module, it works fine (tested now after using QualityCheck )

Last edited by Terisa de morgan; 05-10-2022 at 04:36 PM.
Terisa de morgan is offline   Reply With Quote
Old 05-13-2022, 01:05 AM   #854
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,091
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by un_pogaz View Post
Hey, a make a module.
The purpose of this module is to update the title and/or author sorting key, like the options in the Bulk Metadata dialog, options that are unavailable via Action Chains (I won't open the huge Bulk Metadata dialog just to check the same 2 options everytime => go on to make a non-interactive module).

I remember you had created a thread to reference different user modules (and other event managers), but I couldn't find it.
If it exists, it would be nice to have an explicit link in the description (so that we can look for it before breaking our heads to do things ourselves, especially if we don't understand anything in code)

Here is the code of the module:
EDIT: code moved into the dedicated thread
Thanks for your contribution. I added a link to your module in the first post of the Action Chains Scripts thread.

One suggestion I have is to make the action support the scopes feature as illustrated in the code below (modifications highlighted in blue)

Code:
import os, copy

try:
    from qt.core import (QApplication, Qt, QWidget, QGridLayout, QHBoxLayout, QVBoxLayout,
                            QGroupBox, QCheckBox)
except ImportError:
    from PyQt5.Qt import (QApplication, Qt, QWidget, QGridLayout, QHBoxLayout, QVBoxLayout,
                            QGroupBox, QCheckBox)

from calibre import prints
from calibre.constants import DEBUG

from calibre_plugins.action_chains.actions.base import ChainAction

class BulkSortKeyAction(ChainAction):
    
    # the name of your action
    name = 'Bulk Sort Key'
    
    support_scopes = True
    
    def run(self, gui, settings, chain):
        
        cache = gui.current_db.new_api
        self.ids = chain.scope().get_book_ids()
        #self.ids = gui.current_view().selectionModel().selectedRows()
        if not self.ids or len(self.ids) == 0:
            return
        #self.ids = gui.library_view.get_selected_ids()
        
        if settings.get(KEY.SORT_TITLE, DEFAULT[KEY.SORT_TITLE]):
            from calibre.ebooks.metadata import title_sort
            
            lang_map = cache.all_field_for('languages', self.ids)
            title_map = cache.all_field_for('title', self.ids)
            
            def get_sort(book_id):
                try:
                    lang = lang_map[book_id][0]
                except (KeyError, IndexError, TypeError, AttributeError):
                    lang = DEFAULT_LANG
                return title_sort(title_map[book_id], lang=lang)
            
            cache.set_field('sort', {bid:get_sort(bid) for bid in self.ids})
        
        if settings.get(KEY.SORT_AUTHOR, DEFAULT[KEY.SORT_AUTHOR]):
            author_sort_map = cache.author_sort_strings_for_books(self.ids)
            cache.set_field('author_sort', {book_id: ' & '.join(author_sort_map[book_id]) for book_id in author_sort_map})


    def config_widget(self):
        return ConfigWidget

class KEY:
    SORT_AUTHOR = 'sort_author'
    SORT_TITLE = 'sort_title'

DEFAULT = {}
DEFAULT[KEY.SORT_AUTHOR] = True
DEFAULT[KEY.SORT_TITLE] = True

#set DEFAULT_LANG title sort to the user interface
def get_iso_language():
    from calibre.utils.localization import set_translators, _load_iso639
    iso639 = _load_iso639()
    rslt = 'eng'
    lang = set_translators.lang.split('_')[0].lower()
    if len(lang) == 3:
        if lang in iso639['codes3']:
            rslt = lang
    elif len(lang) == 2:
        rslt = iso639['2to3'].get(lang, rslt)
    elif len(lang) > 3:
        rslt = iso639['name_map'].get(lang, rslt)
    return rslt
DEFAULT_LANG = get_iso_language()

class ConfigWidget(QWidget):
    def __init__(self, plugin_action):
        QWidget.__init__(self)
        self.plugin_action = plugin_action
        self.gui = plugin_action.gui
        self.db = self.gui.current_db
        self._init_controls()

    def _init_controls(self):
        l = self.l = QVBoxLayout()
        self.setLayout(l)
        
        gb_opts = QGroupBox(_("Options"), self)
        l.addWidget(gb_opts)
        l_opts = QVBoxLayout()
        gb_opts.setLayout(l_opts)
        
        self.chk_sort_author = QCheckBox(_("A&utomatically set author sort"))
        self.chk_sort_author.setChecked(DEFAULT[KEY.SORT_AUTHOR])
        self.chk_sort_author.setToolTip(_("This will cause the author sort field to be automatically updated\n"
                                            " based on the authors field for each selected book. Note that if\n"
                                            " you use the control above to set authors in bulk, the author sort\n"
                                            " field is updated anyway, regardless of the value of this checkbox."))
        l_opts.addWidget(self.chk_sort_author)
        
        self.chk_sort_title = QCheckBox(_("Update &title sort"))
        self.chk_sort_title.setChecked(DEFAULT[KEY.SORT_TITLE])
        self.chk_sort_title.setToolTip(_("Update title sort based on the current title. This will be applied only after other changes to title."))
        l_opts.addWidget(self.chk_sort_title)
        
        l.addStretch(1)
        
        self.setMinimumSize(300,100)

    def load_settings(self, settings):
        if not settings:
            settings = copy.deepcopy(DEFAULT)
        
        self.chk_sort_author.setChecked(settings.get(KEY.SORT_AUTHOR, DEFAULT[KEY.SORT_AUTHOR]))
        self.chk_sort_title.setChecked(settings.get(KEY.SORT_TITLE, DEFAULT[KEY.SORT_TITLE]))

    def save_settings(self):
        settings = {}
        settings[KEY.SORT_AUTHOR] = self.chk_sort_author.isChecked()
        settings[KEY.SORT_TITLE] = self.chk_sort_title.isChecked()
        return settings
capink is offline   Reply With Quote
Old 05-13-2022, 04:05 AM   #855
un_pogaz
Chalut o/
un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.un_pogaz understands the importance of being earnest.
 
un_pogaz's Avatar
 
Posts: 410
Karma: 145324
Join Date: Dec 2017
Device: Kobo
Oh, I hadn't followed that addition.
Added.
un_pogaz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Editor Chains capink Plugins 85 Today 05:50 AM
Action Chains Resources capink Plugins 54 01-29-2024 11:24 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 12:36 PM.


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