chiark / gitweb /
Start doing multiple categories as comma separated lists
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 2 Nov 2013 00:14:01 +0000 (01:14 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Sat, 2 Nov 2013 00:14:01 +0000 (01:14 +0100)
Don't drop support for old clients (only one category) yet

fdroidserver/common.py
fdroidserver/stats.py
fdroidserver/update.py

index c1e49470b7dbe3ceecff127a87806c1abe841967..947df11fa0de46017d732dfcbb5a020906606ca8 100644 (file)
@@ -551,7 +551,7 @@ def parse_metadata(metafile, verbose=False):
     # Defaults for fields that come from metadata...
     thisinfo['Name'] = None
     thisinfo['Auto Name'] = ''
-    thisinfo['Category'] = 'None'
+    thisinfo['Categories'] = 'None'
     thisinfo['Description'] = []
     thisinfo['Summary'] = ''
     thisinfo['License'] = 'Unknown'
@@ -761,7 +761,7 @@ def write_metadata(dest, app, verbose=False):
         writefield('Disabled')
     if app['AntiFeatures']:
         writefield('AntiFeatures')
-    writefield('Category')
+    writefield('Categories')
     writefield('License')
     writefield('Web Site')
     writefield('Source Code')
index ad5b82c0b5250a6802bc22c15364ad7f33f5da3e..f84af85a13a9121ac7a18170d6dc6e3071709c2f 100644 (file)
@@ -182,9 +182,9 @@ def main():
 
     ctgs = {}
     for app in metaapps:
-        if app['Category'] is None:
+        if app['Categories'] is None:
             continue
-        categories = [c.strip() for c in app['Category'].split(';')]
+        categories = [c.strip() for c in app['Categories'].split(',')]
         for category in categories:
             if category in ctgs:
                 ctgs[category] += 1;
index 16fe6008c95151e5a610da2c42e9cfa4cc06af8b..85a75def80ac7df3f1a36e3eece24ed95de63391 100644 (file)
@@ -527,14 +527,13 @@ def make_index(apps, apks, repodir, archive, categories):
         addElement('desc', 
                 common.description_html(app['Description'], linkres), 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
             # the desired effect of making clients that only understand one
             # category see that one.
-            cats = app['Category'].split(';')
-            cats.reverse()
-            for cat in cats:
-                addElement('category', cat, doc, apel)
+            addElement('category', categories[0], doc, apel)
         addElement('web', app['Web Site'], doc, apel)
         addElement('source', app['Source Code'], doc, apel)
         addElement('tracker', app['Issue Tracker'], doc, apel)