1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 06:20:12 +01:00

Merge commit 'refs/merge-requests/134' of git://gitorious.org/f-droid/fdroidserver into merge-requests/134

This commit is contained in:
Ciaran Gultnieks 2014-01-23 11:17:33 +00:00
commit 75cf7de7dd

View File

@ -115,6 +115,7 @@ def main():
if options.verbose:
print 'Processing logs...'
apps = {}
appsVer = {}
logexpr = '(?P<ip>[.:0-9a-fA-F]+) - - \[(?P<time>.*?)\] "GET (?P<uri>.*?) HTTP/1.\d" (?P<statuscode>\d+) \d+ "(?P<referral>.*?)" "(?P<useragent>.*?)"'
logsearch = re.compile(logexpr).search
for logfile in glob.glob(os.path.join(logsdir,'access-*.log.gz')):
@ -134,6 +135,12 @@ def main():
apps[appid] += 1
else:
apps[appid] = 1
# Strip the '.apk' from apkname
appVer = apkname[:-4]
if appVer in appsVer:
appsVer[appVer] += 1
else:
appsVer[appVer] = 1
else:
if not apkname in unknownapks:
unknownapks.append(apkname)
@ -153,6 +160,12 @@ def main():
f.write(line + '\n')
f.close()
f = open('stats/total_downloads_app_version.txt', 'w')
f.write('# Total downloads by application and version, since October 2011\n')
for appVer, count in sorted(appsVer):
f.write(appVer + ' ' + str(count) + '\n')
f.close()
# Calculate and write stats for repo types...
if options.verbose:
print "Processing repo types..."