mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-10-09 02:41:06 +03:00
Don't crash if the app icons are wrong
This commit is contained in:
parent
607736f85d
commit
a7f259e7cc
1 changed files with 15 additions and 12 deletions
|
@ -296,7 +296,7 @@ def resize_icon(iconpath, density):
|
||||||
print iconpath, "is small enough:", im.size
|
print iconpath, "is small enough:", im.size
|
||||||
|
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
print "ERROR: Failed resizing {0} - {1}".format(iconpath, e)
|
print "WARNING: Failed resizing {0} - {1}".format(iconpath, e)
|
||||||
|
|
||||||
def resize_all_icons(repodirs):
|
def resize_all_icons(repodirs):
|
||||||
"""Resize all icons that exceed the max size
|
"""Resize all icons that exceed the max size
|
||||||
|
@ -496,6 +496,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
iconfile = open(iconpath, 'wb')
|
iconfile = open(iconpath, 'wb')
|
||||||
iconfile.write(apk.read(iconsrc))
|
iconfile.write(apk.read(iconsrc))
|
||||||
iconfile.close()
|
iconfile.close()
|
||||||
|
try:
|
||||||
im = Image.open(iconpath)
|
im = Image.open(iconpath)
|
||||||
dpi = px_to_dpi(im.size[0])
|
dpi = px_to_dpi(im.size[0])
|
||||||
for density in densities:
|
for density in densities:
|
||||||
|
@ -507,6 +508,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
os.path.join(get_icon_dir(repodir, density), iconfilename))
|
os.path.join(get_icon_dir(repodir, density), iconfilename))
|
||||||
empty_densities.remove(density)
|
empty_densities.remove(density)
|
||||||
break
|
break
|
||||||
|
except Exception,e:
|
||||||
|
print "WARNING: Failed reading {0} - {1}".format(iconpath, e)
|
||||||
|
|
||||||
if thisinfo['icons']:
|
if thisinfo['icons']:
|
||||||
thisinfo['icon'] = iconfilename
|
thisinfo['icon'] = iconfilename
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue