Plugins HowTo
I faced the same problem two years ago. Personally, I started developing a metadata plugin while learning Python (but already knew a dozen other programming languages).
As IDE I use the community version of PyCharm.
For a metadata plugin, the __init__.py file with a class called "PluginName(Source)" is sufficient. At least the Calibre function "identify(self, log, result_queue, abort, title=None, authors=None, identifiers={}, timeout=30)" has to be implemented in it. The author and title are passed and the scraping for the metadata has to be coded. Finally the downloaded metadata is to put in the "mi"-queue structure to pass over to Calibre.
If you also want to download cover images, you also implement "download_cover(self, log, result_queue, abort, title=None, authors=None, identifiers={}, timeout=30, get_best_cover=True)".
That's all.
Of course, you can also distribute the code over several files (then you also need an empty file "plugin-import-name-PluginName.txt") and use workers for parallel tasks, as some plugins do, doing translations...
Then you can control the program flow with custom parameters by implementing a data structure called "options = (}" (see base.py - the Calibre source code on GitHub is really helpful!).
I am developing on a Windows machine. To integrate the plugin locally into Calibre, I use a "plugin_install.bat": "calibre-customize -b .
Test outputs are produced with "log.info()". They are then displayed in the log.
The development of GUI plugins is of course more complex.
I hope this helps!
|