mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
Do the rest of the stats with counters too
This commit is contained in:
parent
f3db0003e7
commit
be7c6aceec
1 changed files with 20 additions and 30 deletions
|
@ -169,7 +169,7 @@ def main():
|
||||||
|
|
||||||
# Calculate and write stats for repo types...
|
# Calculate and write stats for repo types...
|
||||||
logging.info("Processing repo types...")
|
logging.info("Processing repo types...")
|
||||||
repotypes = {}
|
repotypes = Counter()
|
||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
if len(app['Repo Type']) == 0:
|
if len(app['Repo Type']) == 0:
|
||||||
rtype = 'none'
|
rtype = 'none'
|
||||||
|
@ -178,76 +178,66 @@ def main():
|
||||||
rtype = common.getsrclibvcs(app['Repo'])
|
rtype = common.getsrclibvcs(app['Repo'])
|
||||||
else:
|
else:
|
||||||
rtype = app['Repo Type']
|
rtype = app['Repo Type']
|
||||||
if rtype in repotypes:
|
repotypes[rtype] += 1
|
||||||
repotypes[rtype] += 1;
|
|
||||||
else:
|
|
||||||
repotypes[rtype] = 1
|
|
||||||
f = open('stats/repotypes.txt', 'w')
|
f = open('stats/repotypes.txt', 'w')
|
||||||
for rtype, count in repotypes.iteritems():
|
for rtype in repotypes:
|
||||||
|
count = repotypes[rtype]
|
||||||
f.write(rtype + ' ' + str(count) + '\n')
|
f.write(rtype + ' ' + str(count) + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# Calculate and write stats for update check modes...
|
# Calculate and write stats for update check modes...
|
||||||
logging.info("Processing update check modes...")
|
logging.info("Processing update check modes...")
|
||||||
ucms = {}
|
ucms = Counter()
|
||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
checkmode = app['Update Check Mode']
|
checkmode = app['Update Check Mode']
|
||||||
if checkmode.startswith('RepoManifest/'):
|
if checkmode.startswith('RepoManifest/'):
|
||||||
checkmode = checkmode[:12]
|
checkmode = checkmode[:12]
|
||||||
if checkmode.startswith('Tags '):
|
if checkmode.startswith('Tags '):
|
||||||
checkmode = checkmode[:4]
|
checkmode = checkmode[:4]
|
||||||
if checkmode in ucms:
|
|
||||||
ucms[checkmode] += 1;
|
ucms[checkmode] += 1;
|
||||||
else:
|
|
||||||
ucms[checkmode] = 1
|
|
||||||
f = open('stats/update_check_modes.txt', 'w')
|
f = open('stats/update_check_modes.txt', 'w')
|
||||||
for checkmode, count in ucms.iteritems():
|
for checkmode in ucms:
|
||||||
|
count = ucms[checkmode]
|
||||||
f.write(checkmode + ' ' + str(count) + '\n')
|
f.write(checkmode + ' ' + str(count) + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
logging.info("Processing categories...")
|
logging.info("Processing categories...")
|
||||||
ctgs = {}
|
ctgs = Counter()
|
||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
if app['Categories'] is None:
|
if app['Categories'] is None:
|
||||||
continue
|
continue
|
||||||
categories = [c.strip() for c in app['Categories'].split(',')]
|
categories = [c.strip() for c in app['Categories'].split(',')]
|
||||||
for category in categories:
|
for category in categories:
|
||||||
if category in ctgs:
|
|
||||||
ctgs[category] += 1;
|
ctgs[category] += 1;
|
||||||
else:
|
|
||||||
ctgs[category] = 1
|
|
||||||
f = open('stats/categories.txt', 'w')
|
f = open('stats/categories.txt', 'w')
|
||||||
for category, count in ctgs.iteritems():
|
for category in ctgs:
|
||||||
|
count = ctgs[category]
|
||||||
f.write(category + ' ' + str(count) + '\n')
|
f.write(category + ' ' + str(count) + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
logging.info("Processing antifeatures...")
|
logging.info("Processing antifeatures...")
|
||||||
afs = {}
|
afs = Counter()
|
||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
if app['AntiFeatures'] is None:
|
if app['AntiFeatures'] is None:
|
||||||
continue
|
continue
|
||||||
antifeatures = [a.strip() for a in app['AntiFeatures'].split(',')]
|
antifeatures = [a.strip() for a in app['AntiFeatures'].split(',')]
|
||||||
for antifeature in antifeatures:
|
for antifeature in antifeatures:
|
||||||
if antifeature in afs:
|
|
||||||
afs[antifeature] += 1;
|
afs[antifeature] += 1;
|
||||||
else:
|
|
||||||
afs[antifeature] = 1
|
|
||||||
f = open('stats/antifeatures.txt', 'w')
|
f = open('stats/antifeatures.txt', 'w')
|
||||||
for antifeature, count in afs.iteritems():
|
for antifeature in afs:
|
||||||
|
count = afs[antifeature]
|
||||||
f.write(antifeature + ' ' + str(count) + '\n')
|
f.write(antifeature + ' ' + str(count) + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# Calculate and write stats for licenses...
|
# Calculate and write stats for licenses...
|
||||||
logging.info("Processing licenses...")
|
logging.info("Processing licenses...")
|
||||||
licenses = {}
|
licenses = Counter()
|
||||||
for app in metaapps:
|
for app in metaapps:
|
||||||
license = app['License']
|
license = app['License']
|
||||||
if license in licenses:
|
|
||||||
licenses[license] += 1;
|
licenses[license] += 1;
|
||||||
else:
|
|
||||||
licenses[license] = 1
|
|
||||||
f = open('stats/licenses.txt', 'w')
|
f = open('stats/licenses.txt', 'w')
|
||||||
for license, count in licenses.iteritems():
|
for license in licenses:
|
||||||
|
count = licenses[license]
|
||||||
f.write(license + ' ' + str(count) + '\n')
|
f.write(license + ' ' + str(count) + '\n')
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue