def __init__(self, path): self.path = os.path.abspath(path) assert not os.path.exists(self.path) os.makedirs(os.path.join(self.path, "images")) self.revfile = open(os.path.join(self.path, "revisions-1.txt"), "wb") self.seen = dict() self.imgcount = 0 self.nfo = None for storage in ['authors', 'html', 'imageinfo']: fn = os.path.join(self.path, storage + '.db') db = sqlite3dbm.open(fn, 'n') db.conn.execute("PRAGMA synchronous = 0") setattr(self, storage, db)
def read_db(self): self.db = sqlite3dbm.open(self.fn)
def create_shelf(self): self.tmpdir = tempfile.mkdtemp() self.path = os.path.join(self.tmpdir, 'sqlite_map_test_db.sqlite') self.smap = sqlite3dbm.open(self.path, flag='c') self.smap_shelf = sqlite3dbm.sshelve.SqliteMapShelf(self.smap)