View Single Post
Old 07-24-2025, 04:23 AM   #7
jsky
Member
jsky began at the beginning.
 
jsky's Avatar
 
Posts: 13
Karma: 10
Join Date: May 2025
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
Dont call other plugins in your plugins initialize method and you wont have initialization issues. As for parameters to pass to identify() looka t how calibre itself calls the plugin identify methods, in sources/identify.py
I read the identify.py and found
Code:
class Worker(Thread):

    def __init__(self, plugin, kwargs, abort):
        Thread.__init__(self)
        self.daemon = True

        self.plugin, self.kwargs, self.rq = plugin, kwargs, Queue()
        self.abort = abort
        self.buf = StringIO()
        self.log = create_log(self.buf)

    def run(self):
        start = time.time()
        try:
            self.plugin.identify(self.log, self.rq, self.abort, **self.kwargs)
        except Exception:
            self.log.exception('Plugin', self.plugin.name, 'failed')
        self.plugin.dl_time_spent = time.time() - start
does it means I have to create a new thread and create a log to pass to identify function?
or is it possible to get the existing instance of "self.log"?
jsky is offline   Reply With Quote