01-04-2012, 08:58 AM | #1 |
Zealot
Posts: 136
Karma: 60
Join Date: Jul 2009
Location: Munich, Germany
Device: Nook Classic rooted; Galaxy S IV with Aldiko, other older devices
|
How do I instantiate new plugins?
For my current pet project ( just restarted work: Pluginize file naming strategy ), I need to configure a queue of plugins that need to be evaluated in order. One plugin (recreating the current Last name - First name strategy) would stay in the core of Calibre, others would be distributed as zip files like all the other plugins we already have.
Not having too much of python experience, I would imagine that for the configuration, I would store a list of class names in some json file. For instantiation, I found the following code: Code:
obj = eval(classname + "()") |
01-04-2012, 09:06 AM | #2 |
creator of calibre
Posts: 44,310
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Look at customize/ui.py to see how the various types of plugins are loaded in calibre. It should contain all the code you need to define your plugins.
|
01-20-2012, 01:36 PM | #3 | |
Zealot
Posts: 136
Karma: 60
Join Date: Jul 2009
Location: Munich, Germany
Device: Nook Classic rooted; Galaxy S IV with Aldiko, other older devices
|
Quote:
Code:
from calibre.library.pathnames.byauthor.strategy import PathnameByAuthor foo = PathnameByAuthor(self) The part which I did not understand yet is how I would initialize such a class of which I might only know the plugin-import-name. |
|
01-20-2012, 01:53 PM | #4 | |
Zealot
Posts: 136
Karma: 60
Join Date: Jul 2009
Location: Munich, Germany
Device: Nook Classic rooted; Galaxy S IV with Aldiko, other older devices
|
Quote:
The plugin marker file needs a dash as last element, not an underscore. e.g. Code:
plugin-import-name-<foo>.txt Code:
plugin-import-name_<foo>.txt |
|
Tags |
database, directory name, directory_file_names, plugins |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Updating plugins | paulfiera | Plugins | 2 | 11-04-2011 09:12 AM |
Can't find my plugins? | Kraftwerk | Plugins | 2 | 10-12-2011 05:07 PM |
Plugins | junkml | Plugins | 32 | 06-19-2009 06:43 AM |
Plugins? | Mitchll | Plugins | 0 | 12-27-2008 02:36 PM |