Quote:
Originally Posted by ownedbycats
I want to display a column icon when there's data files in the book. There's two ways I can see to do this:
1. Create a rule for program: extra_file_names(',') with any value. High-impact.
2. Update a noncomposite column (either #admintags or a new #extrafiles) and use Action Chains to update it. Less impact, but without a way (that I know of) to auto-update it when adding a file (which means forgetting).
Is extra_file_names() very slow, or is there a better option?
|
Other than a python template, extra_file_names() is the only way to determine that something is in the data directory. That function must read the disk to make the determination, so yes, it will not be fast. Whether it is fast enough only you can know. I suspect it will be acceptable because it will only run when the book is visible in the booklist and the answer to extra_file_names() is cached.
As for the action chains, perhaps you can partially solve the problem by running the chain when calibre starts or stops. You might also be able to convince Kovid to add an event to the methods in cache.py that modify the data directory.