only download cover if online

This commit is contained in:
j 2016-02-05 18:17:35 +05:30
parent 66d6f475b2
commit e96847a3f4
1 changed files with 5 additions and 2 deletions

View File

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