diff --git a/backup.py b/backup.py index f5b0d51..f26d74c 100755 --- a/backup.py +++ b/backup.py @@ -57,13 +57,6 @@ def hashify(top): #print(imo_hashes) return ret -def __init_database__(path): - con = sqlite3.connect(path) - cur = con.cursor() - cur.execute('CREATE TABLE IF NOT EXISTS `paths` (`path` TEXT, `imohash` BLOB, `blake` BLOB, UNIQUE(`path`, `imohash`, `blake`));') - con.commit() - return con - def backup(top,db_path): paths = hashify(top) con = __init_database__(db_path) diff --git a/fs_class.py b/fs_class.py index c8c7590..793f191 100644 --- a/fs_class.py +++ b/fs_class.py @@ -1,6 +1,14 @@ #/usr/bin/python def hash_file(path,hash_if_less,sample): return _imohash(path,hash_if_less,sample) + +def __init_database__(path): + con = sqlite3.connect(path) + cur = con.cursor() + #cur.execute('CREATE TABLE IF NOT EXISTS `paths` (`path` TEXT, `imohash` BLOB, `blake` BLOB, UNIQUE(`path`, `imohash`, `blake`));') + + con.commit() + class fs: def __init__(self,top,db_path=None,hash_threshold=1024**2,sample=128*1024): self.top=top