only download cover if online

This commit is contained in:
j 2016-02-05 18:17:35 +05:30
parent 66d6f475b2
commit e96847a3f4

View file

@ -441,6 +441,7 @@ class Item(db.Model):
logger.debug('%s update_preview done', self.id) logger.debug('%s update_preview done', self.id)
def update_icons(self): def update_icons(self):
if state.online:
self.update_cover() self.update_cover()
self.update_preview() self.update_preview()
@ -673,6 +674,8 @@ class File(db.Model):
return re.sub('^\.|\.$|:|/|\?|<|>', '_', string) return re.sub('^\.|\.$|:|/|\?|<|>', '_', string)
prefs = settings.preferences prefs = settings.preferences
prefix = os.sep.join(os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/').split('/')) prefix = os.sep.join(os.path.join(os.path.expanduser(prefs['libraryPath']), 'Books/').split('/'))
if not self.item:
return
j = self.item.json() j = self.item.json()
current_path = self.fullpath() current_path = self.fullpath()
@ -794,9 +797,9 @@ def update_sort_table():
for q in sql: for q in sql:
s.connection().execute(q) s.connection().execute(q)
s.commit() s.commit()
sql = []
layout = db.get_layout() layout = db.get_layout()
sort_indexes = [i[len('ix_sort_'):] for i in layout['indexes'] if i.startswith('ix_sort_')] sort_indexes = [i[len('ix_sort_'):] for i in layout['indexes'] if i.startswith('ix_sort_')]
sql = []
for col in set(Item.sort_keys)-set(sort_indexes): for col in set(Item.sort_keys)-set(sort_indexes):
sql.append('CREATE INDEX ix_sort_{col} ON sort ({col})'.format(col=col)) sql.append('CREATE INDEX ix_sort_{col} ON sort ({col})'.format(col=col))
if not 'sortvalue' in db.get_table_columns('find'): if not 'sortvalue' in db.get_table_columns('find'):