A file type plugin is not the right place to do this and you really shouldn't create an extra db instance. Having multiple db objects writing to the same db is a recipe for bad things to happen. In fact on windows, you will get permission denied errors since windows enforces mandatory file locking.
Instead create a replacement for the add books plugin (you can re-use the calibre add books code for the most part) and have that plugin scan newly imported book records for ones that contain only a single format, and launch a convert for them, by calling the convert books plugin.
|