From 110b0a3543e9e3907e32b4cc46b333b7611a3a08 Mon Sep 17 00:00:00 2001 From: Koen van Eijk Date: Sun, 9 Jun 2024 23:23:24 +0200 Subject: [PATCH] added --storage-path argument to config --- openrecall/config.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/openrecall/config.py b/openrecall/config.py index ea246c0..eb05d4a 100644 --- a/openrecall/config.py +++ b/openrecall/config.py @@ -1,6 +1,24 @@ import os import sys +import argparse +parser = argparse.ArgumentParser( + description="OpenRecall" +) + +parser.add_argument( + "--storage-path", + type=str, + default=None, + help="Path to store the screenshots and database", +) + +args = parser.parse_args() + +if args.storage_path: + appdata_folder = args.storage_path + screenshots_path = os.path.join(appdata_folder, "screenshots") + db_path = os.path.join(appdata_folder, "recall.db") def get_appdata_folder(app_name="openrecall"): if sys.platform == "win32": @@ -18,10 +36,14 @@ def get_appdata_folder(app_name="openrecall"): os.makedirs(path) return path - -appdata_folder = get_appdata_folder() -db_path = os.path.join(appdata_folder, "recall.db") -screenshots_path = os.path.join(appdata_folder, "screenshots") +if args.storage_path: + appdata_folder = args.storage_path + screenshots_path = os.path.join(appdata_folder, "screenshots") + db_path = os.path.join(appdata_folder, "recall.db") +else: + appdata_folder = get_appdata_folder() + db_path = os.path.join(appdata_folder, "recall.db") + screenshots_path = os.path.join(appdata_folder, "screenshots") if not os.path.exists(screenshots_path): try: