on_import = True causes the plugin to run just before the file is added to the database, but not before metadata is read from the file. If you want to change metadata reading, create a metadatareader plugin.

Getting the path to the calibre install directory is platform and installation method dependent. Here is some code to find the path to the plugins subdirectory ina calibre install

Sounds like a function that should be in calibre so it would be callable from a plugin.

BOb

The problem is that the concept of "installation directory" is not well defined for a python program. Indeed, only the windows version could be said to have an "installation directory". Also plugins really shouldn't need to know where calibre is installed.

Thanks for the help. I found my reason why the modifited file wasn't getting imported. I never updated the return statement to reflect the path of the updated file. Now it all seems to work, except the book name metadata isn't getting read correctly. All other fields seem correct except the book name.