View Single Post
Old 10-26-2016, 03:21 PM   #3
Manitu80
Junior Member
Manitu80 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2016
Device: none
Thank you Kovid for the answer.

One option is to save the data from my custom column into an identifier (by using a GUI plugin), and than to pick it up from the identifier in my metadata download plugin.

For example:
In the gui plugin:
Code:
       rows = self.gui.library_view.selectionModel().selectedRows()
       if not rows or len(rows) == 0 :
            return error_dialog(self.gui, _('No selected book'), _('No book selected'), show=True)

       db = self.gui.current_db            
       book_ids = self.gui.library_view.get_selected_ids()

       for id in book_ids:
            mi = db.get_metadata (id, index_is_id=True, get_cover=False)
            mi.set_identifier('id_title_orig', mi.get("#title_orig"))
In the metadata plugin:
Code:
    def identify(self, log, result_queue, abort, title=None, authors=None,
            identifiers={}, timeout=30):
        # ...        
        title_orig = identifiers.get('id_title_orig', None)
        if title_orig:
            title=title_orig
I've tested the idea above and looks promising.

Now I have another question:
How can I chain the execution of the 2 plugins above? It is possible to start the execution of the metadata download plugin from a GUI plugin (and to wait for execution finish)?

Thank you and best regards
Manitu80 is offline   Reply With Quote