1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

Start doing multiple categories as comma separated lists

Don't drop support for old clients (only one category) yet
This commit is contained in:
Daniel Martí 2013-11-02 01:14:01 +01:00
parent 5644b17048
commit ee759a3a0e
3 changed files with 8 additions and 9 deletions

View File

@ -551,7 +551,7 @@ def parse_metadata(metafile, verbose=False):
# Defaults for fields that come from metadata... # Defaults for fields that come from metadata...
thisinfo['Name'] = None thisinfo['Name'] = None
thisinfo['Auto Name'] = '' thisinfo['Auto Name'] = ''
thisinfo['Category'] = 'None' thisinfo['Categories'] = 'None'
thisinfo['Description'] = [] thisinfo['Description'] = []
thisinfo['Summary'] = '' thisinfo['Summary'] = ''
thisinfo['License'] = 'Unknown' thisinfo['License'] = 'Unknown'
@ -761,7 +761,7 @@ def write_metadata(dest, app, verbose=False):
writefield('Disabled') writefield('Disabled')
if app['AntiFeatures']: if app['AntiFeatures']:
writefield('AntiFeatures') writefield('AntiFeatures')
writefield('Category') writefield('Categories')
writefield('License') writefield('License')
writefield('Web Site') writefield('Web Site')
writefield('Source Code') writefield('Source Code')

View File

@ -182,9 +182,9 @@ def main():
ctgs = {} ctgs = {}
for app in metaapps: for app in metaapps:
if app['Category'] is None: if app['Categories'] is None:
continue continue
categories = [c.strip() for c in app['Category'].split(';')] categories = [c.strip() for c in app['Categories'].split(',')]
for category in categories: for category in categories:
if category in ctgs: if category in ctgs:
ctgs[category] += 1; ctgs[category] += 1;

View File

@ -527,14 +527,13 @@ def make_index(apps, apks, repodir, archive, categories):
addElement('desc', addElement('desc',
common.description_html(app['Description'], linkres), doc, apel) common.description_html(app['Description'], linkres), doc, apel)
addElement('license', app['License'], doc, apel) addElement('license', app['License'], doc, apel)
if 'Category' in app: if 'Categories' in app:
categories = [c.strip() for c in app['Categories'].split(',')]
addElement('categories', ','.join(categories), doc, apel)
# We put the first (primary) category in LAST, which will have # We put the first (primary) category in LAST, which will have
# the desired effect of making clients that only understand one # the desired effect of making clients that only understand one
# category see that one. # category see that one.
cats = app['Category'].split(';') addElement('category', categories[0], doc, apel)
cats.reverse()
for cat in cats:
addElement('category', cat, doc, apel)
addElement('web', app['Web Site'], doc, apel) addElement('web', app['Web Site'], doc, apel)
addElement('source', app['Source Code'], doc, apel) addElement('source', app['Source Code'], doc, apel)
addElement('tracker', app['Issue Tracker'], doc, apel) addElement('tracker', app['Issue Tracker'], doc, apel)