Thanks for the quick reply. Still some questions:
Quote:
Originally Posted by kovidgoyal
1. You store persistent data, just like any other settings, in the config directory, they are not touched by install/uninstalls of plugins. See http://manual.calibre-ebook.com/crea...of-your-plugin
You wont store it as a .txt file, instead it will be stored as a string in a JSON file.
|
Thanks - makes sense. I suppose then the plugin should provide a way for the user to revert to the default bad word list.
Quote:
Originally Posted by kovidgoyal
2. Dont store book specific data as a file. Store it in the database. Using db.new_api.add_custom_data and db.new_api.get_custom_data
Naturally this will only work in a user interface pugin, which has access ot the db
3. Use two plugins. You can technically get fancy and have your user interface plugin install the file type plugin on initialization, but that is a hack and likely to break in the future.
|
1. Storing book specific data in db versus a file. Normally I would agree with you that any meta-data should be in the db especially if it is used for sorting or searching, but this seems more like an attachment to the book that the db could reference rather that store. The data consists of a list of ('bad word', bad_word_count) tuple values and could be "large" depending on the size of the bad word list. Is it worth cluttering up the db with what could become a rather large amount of seldomly used information? There will be a bad word tag added to the book that the user can search on and if he so desires can then open up the list of bad word counts in a viewer.
2. Using: db.new_api.add_custom_data and db.new_api.get_custom_data. I would like to learn how to use this anyway. I have seen the documentation, (add_custom_book_data(name, val_map, delete_first=False) but don't understand what a value map is. Is this just a string? And is <name> any name of my choosing? (unique of course)
3. FileTypePlugin and db. Above you stated that I would need an InterfacePlugin to get access to the db. I presume you only meant if the user was wanting to see something since the FileTypePlugin would need to db access as well and I believe that is possible from the examples I have seen.
BTW - you have provided a real service with Calibre. It is a wonderful tool and I have already loaded it on multiple friends systems! I salute you.