use new default poster, remove black posters from icon cache

This commit is contained in:
j 2016-01-10 12:56:46 +05:30
commit 59a3709f84
6 changed files with 61 additions and 32 deletions

View file

@ -207,6 +207,30 @@ def upgrade_db(old, new=None):
if sys.platform.startswith('linux'):
import integration
integration.install_xdg()
if old <= '20160110-581-e08780a' and new > '20160110-581-e08780a':
with db.session():
import item.models
from item.icons import icons
for f in item.models.File.query:
if f.info['extension'] == 'epub':
i = f.item
key = 'cover:%s'%i.id
cover = icons[key]
key = 'preview:%s'%i.id
preview = i.extract_preview()
update_item = False
if not preview:
del icons[key]
for resolution in (128, 256, 512):
del icons['%s:%s' % (key, resolution)]
if 'previewRatio' in i.info:
del i.info['previewRatio']
update_item = True
if not cover and 'coverRatio' in i.info:
del i.info['coverRatio']
update_item = True
if update_item:
i.save()
if old <= '20140527-120-3cb9819':
run_sql('CREATE INDEX ix_find_findvalue ON find (findvalue)')