From d9d8448035fbd9a528205bb18721371e53331b9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Tue, 7 Jan 2014 16:17:38 +0100 Subject: [PATCH] Keep the same ZipFile instance to retrieve all the icons --- fdroidserver/update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 4a86611b..67088b6e 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -458,6 +458,8 @@ def scan_apks(apps, apkcache, repodir, knownapks): sys.exit(1) thisinfo['sig'] = output[7:].strip() + apk = zipfile.ZipFile(apkfile, 'r') + iconfilename = "%s.%s.png" % ( thisinfo['id'], thisinfo['versioncode']) @@ -469,7 +471,6 @@ def scan_apks(apps, apkcache, repodir, knownapks): if density not in thisinfo['icons_src']: empty_densities.append(density) continue - apk = zipfile.ZipFile(apkfile, 'r') if 'icons' not in thisinfo: thisinfo['icons'] = {} iconsrc = thisinfo['icons_src'][density] @@ -488,10 +489,10 @@ def scan_apks(apps, apkcache, repodir, knownapks): del thisinfo['icons_src'][density] empty_densities.append(density) - apk.close() - resize_icon(icondest, density) + apk.close() + # First try resizing down to not lose quality last_density = None for density in densities: -- 2.30.2