chiark / gitweb /
Two new stats files: categories.txt, antifeatures.txt
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 31 Oct 2013 12:08:15 +0000 (13:08 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 31 Oct 2013 12:08:15 +0000 (13:08 +0100)
fdroidserver/stats.py

index eb118409ebf33525b9e99d5fb6f1c8fcca2ef271..6d78fee7a611c13f937ba43eaf41f9cc87db2739 100644 (file)
@@ -182,6 +182,37 @@ def main():
         f.write(checkmode + ' ' + str(count) + '\n')
     f.close()
 
+    ctgs = {}
+    for app in metaapps:
+        if app['Category'] is None:
+            continue
+        categories = [c.strip() for c in app['Category'].split(';')]
+        for category in categories:
+            if category in ctgs:
+                ctgs[category] += 1;
+            else:
+                ctgs[category] = 1
+    f = open('stats/categories.txt', 'w')
+    for category, count in ctgs.iteritems():
+        f.write(category + ' ' + str(count) + '\n')
+    f.close()
+
+    afs = {}
+    for app in metaapps:
+        if app['AntiFeatures'] is None:
+            continue
+        antifeatures = [a.strip() for a in app['AntiFeatures'].split(',')]
+        for antifeature in antifeatures:
+            if antifeature in afs:
+                afs[antifeature] += 1;
+            else:
+                afs[antifeature] = 1
+    f = open('stats/antifeatures.txt', 'w')
+    for antifeature, count in afs.iteritems():
+        f.write(antifeature + ' ' + str(count) + '\n')
+    f.close()
+    return
+
     # Calculate and write stats for licenses...
     licenses = {}
     for app in metaapps: