1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 10:40:12 +02:00

Add 640 dpi icons dir

This commit is contained in:
Daniel Martí 2014-01-07 15:55:07 +01:00
parent 41503aa7bc
commit e78878c2ea

View File

@ -36,14 +36,11 @@ from PIL import Image
def get_densities():
return ['480', '320', '240', '160', '120']
return ['640', '480', '320', '240', '160', '120']
def launcher_size(density):
return (int(density) * 48) / 160
def icon_dens_label(density):
return "icon-%s" % density
def get_icon_dir(repodir, density):
if density is None:
return os.path.join(repodir, "icons")
@ -454,11 +451,12 @@ def scan_apks(apps, apkcache, repodir, knownapks):
densities = get_densities()
empty_densities = []
for density in densities:
label = icon_dens_label(density)
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]
icon_dir = get_icon_dir(repodir, density)
icondest = os.path.join(icon_dir, iconfilename)
@ -467,11 +465,11 @@ def scan_apks(apps, apkcache, repodir, knownapks):
iconfile = open(icondest, 'wb')
iconfile.write(apk.read(iconsrc))
iconfile.close()
thisinfo[label] = iconfilename
thisinfo['icons'][density] = iconfilename
except:
print "WARNING: Error retrieving icon file"
del thisinfo[label]
del thisinfo['icons'][density]
del thisinfo['icons_src'][density]
empty_densities.append(density)