1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 02:50:12 +01:00

Latest 10 apps (not entirely correct yet, missing some data)

This commit is contained in:
Ciaran Gultnieks 2012-01-22 14:03:56 +00:00
parent 3f02d0e126
commit ba353c71d4
2 changed files with 26 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import glob, os, sys, re
import shutil import shutil
import subprocess import subprocess
import time import time
import operator
def getvcs(vcstype, remote, local): def getvcs(vcstype, remote, local):
if vcstype == 'git': if vcstype == 'git':
@ -821,3 +822,20 @@ class KnownApks:
if apkname in self.apks: if apkname in self.apks:
return self.apks[apkname] return self.apks[apkname]
return None return None
def getlatest(self, num):
apps = {}
for apk, app in self.apks.iteritems():
appid, added = app
if added:
if appid in apps:
if apps[appid] > added:
apps[appid] = added
else:
apps[appid] = added
sortedapps = sorted(apps.iteritems(), key=operator.itemgetter(1))[-num:]
lst = []
for app, added in sortedapps:
lst.append(app)
return lst

View File

@ -121,6 +121,7 @@ for logfile in glob.glob(os.path.join(logsdir,'access-*.log')):
if not apkname in unknownapks: if not apkname in unknownapks:
unknownapks.append(apkname) unknownapks.append(apkname)
# Calculate and write stats for total downloads...
f = open('stats/total_downloads_app.txt', 'w') f = open('stats/total_downloads_app.txt', 'w')
lst = [] lst = []
alldownloads = 0 alldownloads = 0
@ -133,6 +134,13 @@ for line in sorted(lst):
f.write(line + '\n') f.write(line + '\n')
f.close() f.close()
# Write list of latest apps added to the repo...
latest = knownapks.getlatest(10)
f = open('stats/latestapps.txt', 'w')
for app in latest:
f.write(app + '\n')
f.close()
if len(unknownapks) > 0: if len(unknownapks) > 0:
print '\nUnknown apks:' print '\nUnknown apks:'
for apk in unknownapks: for apk in unknownapks: