mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
Create icons dicts like the rest
This commit is contained in:
parent
729f457f0b
commit
5d5a4df7d1
@ -361,6 +361,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
|||||||
thisinfo['size'] = os.path.getsize(apkfile)
|
thisinfo['size'] = os.path.getsize(apkfile)
|
||||||
thisinfo['permissions'] = []
|
thisinfo['permissions'] = []
|
||||||
thisinfo['features'] = []
|
thisinfo['features'] = []
|
||||||
|
thisinfo['icons_src'] = {}
|
||||||
|
thisinfo['icons'] = {}
|
||||||
p = subprocess.Popen([os.path.join(config['sdk_path'], 'build-tools', config['build_tools'], 'aapt'),
|
p = subprocess.Popen([os.path.join(config['sdk_path'], 'build-tools', config['build_tools'], 'aapt'),
|
||||||
'dump', 'badging', apkfile],
|
'dump', 'badging', apkfile],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
@ -380,23 +382,17 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif line.startswith("application:"):
|
elif line.startswith("application:"):
|
||||||
thisinfo['name'] = re.match(label_pat, line).group(1)
|
thisinfo['name'] = re.match(label_pat, line).group(1)
|
||||||
if 'icons_src' not in thisinfo:
|
|
||||||
thisinfo['icons_src'] = {}
|
|
||||||
# Keep path to non-dpi icon in case we need it
|
# Keep path to non-dpi icon in case we need it
|
||||||
match = re.match(icon_pat_nodpi, line)
|
match = re.match(icon_pat_nodpi, line)
|
||||||
if match:
|
if match:
|
||||||
thisinfo['icons_src']['-1'] = match.group(1)
|
thisinfo['icons_src']['-1'] = match.group(1)
|
||||||
elif line.startswith("launchable-activity:"):
|
elif line.startswith("launchable-activity:"):
|
||||||
if 'icons_src' not in thisinfo:
|
|
||||||
thisinfo['icons_src'] = {}
|
|
||||||
# Only use launchable-activity as fallback to application
|
# Only use launchable-activity as fallback to application
|
||||||
elif '-1' not in thisinfo['icons_src']:
|
if '-1' not in thisinfo['icons_src']:
|
||||||
match = re.match(icon_pat_nodpi, line)
|
match = re.match(icon_pat_nodpi, line)
|
||||||
if match:
|
if match:
|
||||||
thisinfo['icons_src']['-1'] = match.group(1)
|
thisinfo['icons_src']['-1'] = match.group(1)
|
||||||
elif line.startswith("application-icon-"):
|
elif line.startswith("application-icon-"):
|
||||||
if 'icons_src' not in thisinfo:
|
|
||||||
thisinfo['icons_src'] = {}
|
|
||||||
match = re.match(icon_pat, line)
|
match = re.match(icon_pat, line)
|
||||||
if match:
|
if match:
|
||||||
density = match.group(1)
|
density = match.group(1)
|
||||||
@ -471,8 +467,6 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
|||||||
if density not in thisinfo['icons_src']:
|
if density not in thisinfo['icons_src']:
|
||||||
empty_densities.append(density)
|
empty_densities.append(density)
|
||||||
continue
|
continue
|
||||||
if 'icons' not in thisinfo:
|
|
||||||
thisinfo['icons'] = {}
|
|
||||||
iconsrc = thisinfo['icons_src'][density]
|
iconsrc = thisinfo['icons_src'][density]
|
||||||
icon_dir = get_icon_dir(repodir, density)
|
icon_dir = get_icon_dir(repodir, density)
|
||||||
icondest = os.path.join(icon_dir, iconfilename)
|
icondest = os.path.join(icon_dir, iconfilename)
|
||||||
@ -491,6 +485,9 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
|||||||
|
|
||||||
resize_icon(icondest, density)
|
resize_icon(icondest, density)
|
||||||
|
|
||||||
|
if '-1' in thisinfo['icons_src']:
|
||||||
|
pass #TODO
|
||||||
|
|
||||||
apk.close()
|
apk.close()
|
||||||
|
|
||||||
# First try resizing down to not lose quality
|
# First try resizing down to not lose quality
|
||||||
|
Loading…
Reference in New Issue
Block a user