mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
Added license and vcs type analysis to stats
This commit is contained in:
parent
4bec91d24c
commit
702c881d72
@ -43,6 +43,8 @@ def main():
|
||||
help="Download logs we don't have")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Get all metadata-defined apps...
|
||||
metaapps = common.read_metadata(options.verbose)
|
||||
|
||||
statsdir = 'stats'
|
||||
logsdir = os.path.join(statsdir, 'logs')
|
||||
@ -123,18 +125,49 @@ def main():
|
||||
unknownapks.append(apkname)
|
||||
|
||||
# Calculate and write stats for total downloads...
|
||||
f = open('stats/total_downloads_app.txt', 'w')
|
||||
lst = []
|
||||
alldownloads = 0
|
||||
for app, count in apps.iteritems():
|
||||
lst.append(app + " " + str(count))
|
||||
alldownloads += count
|
||||
lst.append("ALL " + str(alldownloads))
|
||||
f = open('stats/total_downloads_app.txt', 'w')
|
||||
f.write('# Total downloads by application, since October 2011\n')
|
||||
for line in sorted(lst):
|
||||
f.write(line + '\n')
|
||||
f.close()
|
||||
|
||||
# Calculate and write stats for repo types...
|
||||
repotypes = {}
|
||||
for app in metaapps:
|
||||
if len(app['Repo Type']) == 0:
|
||||
rtype = 'none'
|
||||
else:
|
||||
rtype = app['Repo Type']
|
||||
if rtype in repotypes:
|
||||
repotypes[rtype] += 1;
|
||||
else:
|
||||
repotypes[rtype] = 1
|
||||
f = open('stats/repotypes.txt', 'w')
|
||||
for rtype, count in repotypes.iteritems():
|
||||
f.write(rtype + ' ' + str(count) + '\n')
|
||||
f.close()
|
||||
|
||||
# Calculate and write stats for licenses...
|
||||
licenses = {}
|
||||
for app in metaapps:
|
||||
license = app['License']
|
||||
if license in licenses:
|
||||
licenses[license] += 1;
|
||||
else:
|
||||
licenses[license] = 1
|
||||
f = open('stats/licenses.txt', 'w')
|
||||
for license, count in licenses.iteritems():
|
||||
f.write(license + ' ' + str(count) + '\n')
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
# Write list of latest apps added to the repo...
|
||||
latest = knownapks.getlatest(10)
|
||||
f = open('stats/latestapps.txt', 'w')
|
||||
|
Loading…
Reference in New Issue
Block a user