Nach Datum sortiert ausgeben dazu

This commit is contained in:
Stefan Bethke 2013-08-06 22:15:28 +00:00
parent 500219a4af
commit e54350c0c6

View file

@ -1,9 +1,10 @@
#!/usr/local/bin/python
# $Schlepperbande: src/tivomirror/dbtool,v 1.2 2010/12/18 09:11:46 stb Exp $
# $Schlepperbande: src/tivomirror/dbtool,v 1.3 2010/12/18 10:03:31 stb Exp $
import anydbm
import getopt
import operator
import os
import sys
@ -11,7 +12,7 @@ def usage():
print >>sys.stderr, "usage: dbtool {-a entry|-d entry|-l}"
try:
optlist, args = getopt.getopt(sys.argv[1:], "a:d:l")
optlist, args = getopt.getopt(sys.argv[1:], "a:d:lk")
except getopt.GetoptError, err:
print >>sys.stderr, str(err)
usage()
@ -26,6 +27,9 @@ for (o, a) in optlist:
if o == "-l":
for i in sorted(downloaddb.keys()):
print "%s:\t%s" % (i, downloaddb[i])
elif o == "-k":
for (k, v) in sorted(downloaddb.items(), key=operator.itemgetter(1)):
print "%s:\t%s" % (k, v)
elif o == "-d":
del downloaddb[a]
elif o == "-a":