]> git.phdru.name Git - xsetbg.git/blob - reload_db.py
Rename db_file to xsetbg_db_path
[xsetbg.git] / reload_db.py
1 #! /usr/bin/env python
2 """Reload a dump into DB
3
4 This file is a part of XSetBg.
5
6 """
7
8 __author__ = "Oleg Broytman <phd@phdru.name>"
9 __copyright__ = "Copyright (C) 2007-2014 PhiloSoft Design"
10 __license__ = "GNU GPL"
11
12 import sys, shelve
13 from xsetbg_db import xsetbg_db_path
14
15 dump_file = open(sys.argv[1], 'rU')
16
17 xsetbg_db = shelve.open(xsetbg_db_path, flag='n')
18 for line in dump_file:
19    timestamp, filename = line.strip().split(None, 1)
20    xsetbg_db[filename] = float(timestamp)
21 xsetbg_db.close()
22 dump_file.close()