I'm mobile right now, cannot check the source code and offer specific examples, but what I'm basically thinking is that you should be able to get the images by instantiating your plugin in the calibre-debug subprocess and using
https://manual.calibre-ebook.com/plu...load_resources
Also see cli_main() there. This seems like a much simpler approach: You'd want to allow the cli_main entry point to spin up your QApplication with a path to an ebook file in order to run the plugin, just as if you had used the batch file instead.
In fact, this could replace the batch file. Users would simply install the plugin, and then the batch file would run 'calibre-debug --run-plugin ScrambleEbook path-to-epub'.
Then the final step would be that on newer versions of Calibre with webengine instead of webkit, the plugin will simply call run_calibre_debug and start up the command line interface for the plugin.
If this isn't enough of a hint for you, I will try to explain in greater detail and hopefully with code samples, tonight or tomorrow or something. Or Kovid can fill in the blanks.