Added dates for when added and last updated to repo index

Under each 'app' element there is now an 'added' and a 'lastupdated'
element with the date the application was originally added to the repo,
and when the most recent version was added. Under each 'apk' element there
is also an 'added' for that particular version. For all three of these,
the element contains just a date in YYYY-MM-DD format.
This commit is contained in:
Ciaran Gultnieks 2012-07-12 21:48:59 +01:00
parent e947f87fc7
commit 16679b005f
2 changed files with 42 additions and 4 deletions

View file

@ -1100,16 +1100,24 @@ class KnownApks:
f.write(line + '\n')
f.close()
# Record an apk (if it's new, otherwise does nothing)
# Returns the date it was added.
def recordapk(self, apk, app):
if not apk in self.apks:
self.apks[apk] = (app, time.gmtime(time.time()))
self.changed = True
_, added = self.apks[apk]
return added
# Look up information - given the 'apkname', returns (app id, date added/None).
# Or returns None for an unknown apk.
def getapp(self, apkname):
if apkname in self.apks:
return self.apks[apkname]
return None
# Get the most recent 'num' apps added to the repo, as a list of package ids
# with the most recent first.
def getlatest(self, num):
apps = {}
for apk, app in self.apks.iteritems():