diff options
author | Victor Häggqvist <[email protected]> | 2014-09-02 11:27:50 +0200 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2014-09-02 11:27:50 +0200 |
commit | bcbd5bb12b3a1f89948d21a7a9bc0f056db73f38 (patch) | |
tree | f95b967cd8dec52fadba96c85cf03a635bb272f3 /xboomx/bin/xboomx_update.py |
--status
Diffstat (limited to 'xboomx/bin/xboomx_update.py')
-rw-r--r-- | xboomx/bin/xboomx_update.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/xboomx/bin/xboomx_update.py b/xboomx/bin/xboomx_update.py new file mode 100644 index 0000000..892bc4c --- /dev/null +++ b/xboomx/bin/xboomx_update.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +import sys +import fileinput + +import xboomx.db + + +def main(): + # get db type + db_type = '' + if len(sys.argv) > 1: + db_type = sys.argv[1] + # open db + db = xboomx.db.open_shelve(db_type) + + # get item to update + item = fileinput.input([]).next() + item = item.strip('\n') + + # update item + db[item] = db.get(item, 0) + 1 + + # print it + print item + + # clean up + db.sync() + db.close() + + +main() |