Kleines Tool um die Downloaddatenbank zu bearbeiten
This commit is contained in:
parent
4b00bad4c2
commit
b8a12f7c44
1 changed files with 33 additions and 0 deletions
33
src/tivomirror/dbtool
Executable file
33
src/tivomirror/dbtool
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# $Schlepperbande$
|
||||||
|
|
||||||
|
import anydbm
|
||||||
|
import getopt
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def usage():
|
||||||
|
print >>sys.stderr, "usage: dbtool {-a entry|-d entry|-l}"
|
||||||
|
|
||||||
|
try:
|
||||||
|
optlist, args = getopt.getopt(sys.argv[1:], "a:d:l")
|
||||||
|
except getopt.GetoptError, err:
|
||||||
|
print >>sys.stderr, str(err)
|
||||||
|
usage()
|
||||||
|
sys.exit(64)
|
||||||
|
if len(args) != 0 or len(optlist) != 1:
|
||||||
|
usage()
|
||||||
|
sys.exit(64)
|
||||||
|
|
||||||
|
downloaddb = anydbm.open("tivo/.downloads", "c")
|
||||||
|
|
||||||
|
for (o, a) in optlist:
|
||||||
|
if o == "-l":
|
||||||
|
for i in sorted(downloaddb.keys()):
|
||||||
|
print "%s: %s" % (i, downloaddb[i])
|
||||||
|
elif o == "-d":
|
||||||
|
del downloaddb[a]
|
||||||
|
elif o == "-a":
|
||||||
|
downloaddb[a] = "manually added"
|
||||||
|
|
||||||
|
downloaddb.close()
|
Loading…
Reference in a new issue