From ac6435d17f22cea1740bc2b2fe3f02e3afaef088 Mon Sep 17 00:00:00 2001 From: Debian Live user <> Date: Thu, 28 Oct 2021 12:10:35 +0200 Subject: [PATCH] small config change --- .idea/misc.xml | 2 +- .idea/workspace.xml | 36 ------------------------------------ backup.py | 6 +++--- main.py | 4 ++-- 4 files changed, 6 insertions(+), 42 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d56657a..79ebe2f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4372b4f..faad361 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,30 +1,5 @@ - - - - - - - - - - - - - - - - - - @@ -48,15 +23,4 @@ - - - - - 1631795633473 - - - \ No newline at end of file diff --git a/backup.py b/backup.py index edcd38e..059cb4f 100644 --- a/backup.py +++ b/backup.py @@ -85,7 +85,7 @@ class Backup: upload_file(enc, self.save_mode, file_name=os.path.join(self.save_location, crypt_name), bucket=self.buk) def recover_file(self, paths, parents=False, save_path=os.getcwd()): - files = self.bdd.get_crypt_file(paths) + files = self.bdd.get_crypt_name(paths) for file in files: if file['crypt'] is not None: encrypted_file = download_file(self.save_mode, os.path.join(self.save_location, file['crypt']), bucket=self.buk) @@ -245,12 +245,12 @@ class DataBase: self.conn.commit() - def get_crypt_file(self, list_file): + def get_crypt_name(self, list_file): cursor = self.conn.cursor() crypt_list = [] # for path in [file['path'] for file in list_file]: for path in list_file: - path = pathlib.Path(path).as_posix() + path = pathlib.PureWindowsPath(path).as_posix() cursor.execute("""SELECT crypt_id, compress_mode FROM files INNER JOIN crypt ON files.crypt_id = crypt.id WHERE path=?""", (path,)) diff --git a/main.py b/main.py index 171cd12..4f107ba 100644 --- a/main.py +++ b/main.py @@ -24,6 +24,6 @@ bdd = "bdd.db" bck = Backup(key, save_mode=backup.LOCAL, bdd=bdd, save_location="crypted") rootdir = "test" -bck.save(rootdir).save("test2") +bck.save(rootdir).save("share", recurse=False) -bck.recover_file(paths=["test\\depth1\\depth2\\1316614572_leopard.jpg", "test/depth1/depth1_text - Copie.txt"], save_path="recovered") +bck.recover_file(paths=["test\\tmp597556213336506368.jpg", "share/archive.tar"], save_path="recovered")