Quote:
Originally Posted by eschwartz
P.S. chaley, thanks for the similar python script you created in the templates, plugboards, custom columns thread a while back, you helped me figure out how to interface with calibre. 
Does this look good?
|
Looks mostly good.
Some comments:
- Why did you create the temp file for the txt format instead of simply using its path?
EDIT: ahhh, I see. You created an empty txt file to avoid the necessity of passing one in as an argument or having one sitting around.
- You should first get the IDs that don't have a TXT format and add it only to them. Use something like cache.search('not formats:=TXT'). This is where the user could also add some criteria, such as doing it only if a book has a certain tag.
- You might want to put try/except around the add_format
- Is it worth checking add_format's returned value and printing an error?