View Single Post
Old 06-22-2011, 07:51 PM   #34
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You're fine, the only difference for you is that every time you use cover(..., as_path=True) a temp file is created and the cover is copied to it. The tempfile is automatically deleted when you close calibre.

I would suggest that you use a single call to both get the cover data and test for its existence, like this:

Code:
cover_data = db.cover(row, index_is_id=False, as_path=False)
if cover_data is None:
   # no cover present
else:
   # cover present
And let me emphasize that the changes should not break any existing plugins. The worst that will happen is that a plugin will run slower and create lots of temp files.
kovidgoyal is offline   Reply With Quote