'Cache has_cover'

def upgrade_version_14(self):

    self.db.execute(u'ALTER    TABLE    books    ADD    COLUMN    has_cover    BOOL    DEFAULT    0')
    data = self.db.get(u'SELECT    id,path    FROM    books', all=True)
    def has_cover(path):
        if path:
            path = os.path.join(self.library_path, path.replace(u'/', os.sep), u'cover.jpg')
            return os.path.exists(path)
        return False
    ids = [(x[0],) for x in data if has_cover(x[1])]
    self.db.executemany(u'UPDATE    books    SET    has_cover=1    WHERE    id=?', ids)
