mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Latest 10 apps (not entirely correct yet, missing some data)
This commit is contained in:
parent
3f02d0e126
commit
ba353c71d4
2 changed files with 26 additions and 0 deletions
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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue