@DaltonST
Even if I initially planned to do this without GUI (I don't know if it's feasable) I used your code snippet and it worked as it shows the result in the GUI.
Code:
self.gui.search.clear()
self.gui.search.set_search_string('id:'+searchId)
rows = self.gui.library_view.selectionModel().selectedRows()
if not rows or len(rows) == 0:
popuptext += "ERROR: No book found for id: "+searchId+"\n"
elif len(rows) > 1:
popuptext += "ERROR: multiple books found for id: "+searchId+"\n"
else:
popuptext += "Found 1 matching row ID " + str(list(map(self.gui.library_view.model().id, rows))[0]) + "\n"
Last line returns the book id as expected in searchId.
Next step is to be able to change the metadata from an external opf file (on disk) or from field values in it.
I guess I need to use
Code:
self.gui.iactions['Edit Metadata'].paste_metadata()
But data needs to be copied first and copy_metadata() copies from a selected book entry.
There is a download_metadata() method, but no upload_metadata().
Do you recommend to overload this class and create an upload_metadata(opf_file) or is there an existing/better way (I haven't found so far)?