small config change

This commit is contained in:
Debian Live user 2021-10-28 12:10:35 +02:00
parent 617e49fa02
commit ac6435d17f
4 changed files with 6 additions and 42 deletions

2
.idea/misc.xml generated
View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (cryptAES)" project-jdk-type="Python SDK" />
</project> </project>

36
.idea/workspace.xml generated
View File

@ -1,30 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager">
<list default="true" id="3be09a79-ba49-407e-8f34-349a7b2cd6dc" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/crypt.py" beforeDir="false" afterPath="$PROJECT_DIR$/crypt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1yDognagEJqmR8tbCJ4eCX0Fhyf" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
</component>
<component name="RunManager"> <component name="RunManager">
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true"> <configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
<module name="crypt" /> <module name="crypt" />
@ -48,15 +23,4 @@
<method v="2" /> <method v="2" />
</configuration> </configuration>
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3be09a79-ba49-407e-8f34-349a7b2cd6dc" name="Changes" comment="" />
<created>1631795633473</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1631795633473</updated>
</task>
<servers />
</component>
</project> </project>

View File

@ -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) 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()): 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: for file in files:
if file['crypt'] is not None: if file['crypt'] is not None:
encrypted_file = download_file(self.save_mode, os.path.join(self.save_location, file['crypt']), bucket=self.buk) 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() self.conn.commit()
def get_crypt_file(self, list_file): def get_crypt_name(self, list_file):
cursor = self.conn.cursor() cursor = self.conn.cursor()
crypt_list = [] crypt_list = []
# for path in [file['path'] for file in list_file]: # for path in [file['path'] for file in list_file]:
for path 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 cursor.execute("""SELECT crypt_id, compress_mode FROM files
INNER JOIN crypt ON files.crypt_id = crypt.id INNER JOIN crypt ON files.crypt_id = crypt.id
WHERE path=?""", (path,)) WHERE path=?""", (path,))

View File

@ -24,6 +24,6 @@ bdd = "bdd.db"
bck = Backup(key, save_mode=backup.LOCAL, bdd=bdd, save_location="crypted") bck = Backup(key, save_mode=backup.LOCAL, bdd=bdd, save_location="crypted")
rootdir = "test" 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")