mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-13 02:30:11 +01:00
Latest 10 apps (not entirely correct yet, missing some data)
This commit is contained in:
parent
3f02d0e126
commit
ba353c71d4
18
common.py
18
common.py
@ -20,6 +20,7 @@ import glob, os, sys, re
|
||||
import shutil
|
||||
import subprocess
|
||||
import time
|
||||
import operator
|
||||
|
||||
def getvcs(vcstype, remote, local):
|
||||
if vcstype == 'git':
|
||||
@ -821,3 +822,20 @@ class KnownApks:
|
||||
if apkname in self.apks:
|
||||
return self.apks[apkname]
|
||||
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
|
||||
|
||||
|
@ -121,6 +121,7 @@ for logfile in glob.glob(os.path.join(logsdir,'access-*.log')):
|
||||
if not apkname in unknownapks:
|
||||
unknownapks.append(apkname)
|
||||
|
||||
# Calculate and write stats for total downloads...
|
||||
f = open('stats/total_downloads_app.txt', 'w')
|
||||
lst = []
|
||||
alldownloads = 0
|
||||
@ -133,6 +134,13 @@ for line in sorted(lst):
|
||||
f.write(line + '\n')
|
||||
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:
|
||||
print '\nUnknown apks:'
|
||||
for apk in unknownapks:
|
||||
|
Loading…
Reference in New Issue
Block a user