diff --git a/auto_import.py b/auto_import.py index c03523d..50207fe 100644 --- a/auto_import.py +++ b/auto_import.py @@ -10,7 +10,7 @@ import json _DEST = "/share/Photo/imported" _DEV = "" _DEV_MOUNT = "/share/external/DEV3304_1/" -_DEV_DIR = "/share/external/DEV3304_1/DCIM/100GOPRO" +_DEV_DIR = "/share/external/DEV3304_1/DCIM/" _IMP_FILE = "/share/external/DEV3304_1/auto_import" _DEV_DATA = "/share/external/DEV3304_1/MISC/version.txt" @@ -43,6 +43,9 @@ while True: if wifimac == "2474f742c017": _DEV = "gopro9_1" print("gopro9_1 registered") + elif wifimac == "2474f7421111": + _DEV = "dji_mini_4" + print("gopro9_1 registered") if os.path.exists(_IMP_FILE) and _DEV == "": print("path exist") @@ -65,33 +68,39 @@ while True: status, output = subprocess.getstatusoutput(myCmd) if not _DEV == "": if os.path.exists(_DEV_DIR): - for filename in os.listdir(_DEV_DIR): - print(filename) - c_time = os.path.getctime("{}/{}".format(_DEV_DIR,filename)) - dt_c = datetime.datetime.fromtimestamp(c_time) - print(dt_c) - _CDAT = dt_c.strftime("%Y-%m-%d") - print(_CDAT) - _FDEST = "{}/{}/{}".format(_DEST,_DEV, _CDAT) - if not os.path.exists(_FDEST): - cmnd = "mkdir -p {}".format(_FDEST) - status, output = subprocess.getstatusoutput(cmnd) - print("Moving file {} into {}".format(filename, _FDEST)) - try: - shutil.move("{}/{}".format(_DEV_DIR,filename),_FDEST) - except: - try: - shutil.move("{}/{}".format(_DEV_DIR,filename),"{}/{}".format(_FDEST,filename)) - except: - print("failed to move file {}".format(filename)) - print("Umounting") - myCmd = "umount /share/external/DEV3304_1" - status, output = subprocess.getstatusoutput(myCmd) - print(output) - print(status) - myCmd = "/sbin/hal_app --se_buzzer enc_id=0,mode=100" - subprocess.getstatusoutput(myCmd) - time.sleep(5) + for file_or_dir in os.listdir(_DEV_DIR): + FULL_PATH = os.path.join(_DEV_DIR, file_or_dir) + if os.path.isdir(FULL_PATH): + print(f"Folder: {file_or_dir}") + for filename in os.listdir(FULL_PATH): + print(filename) + c_time = os.path.getctime("{}/{}".format(_DEV_DIR,filename)) + dt_c = datetime.datetime.fromtimestamp(c_time) + print(dt_c) + _CDAT = dt_c.strftime("%Y-%m-%d") + print(_CDAT) + _FDEST = "{}/{}/{}".format(_DEST,_DEV, _CDAT) + if not os.path.exists(_FDEST): + cmnd = "mkdir -p {}".format(_FDEST) + status, output = subprocess.getstatusoutput(cmnd) + print("Moving file {} into {}".format(filename, _FDEST)) + try: + shutil.move("{}/{}".format(_DEV_DIR,filename),_FDEST) + except: + try: + shutil.move("{}/{}".format(_DEV_DIR,filename),"{}/{}".format(_FDEST,filename)) + except: + print("failed to move file {}".format(filename)) + print("Umounting") + myCmd = "umount /share/external/DEV3304_1" + status, output = subprocess.getstatusoutput(myCmd) + print(output) + print(status) + myCmd = "/sbin/hal_app --se_buzzer enc_id=0,mode=100" + subprocess.getstatusoutput(myCmd) + time.sleep(5) + else: + print(f"File: {file_or_dir}") else: print("Nothing to import") time.sleep(5) diff --git a/cert_checker.py b/cert_checker.py index 94ac283..68ff393 100644 --- a/cert_checker.py +++ b/cert_checker.py @@ -36,7 +36,7 @@ def check_and_write_cert_info(directory_path, output_json_path): rel_files.append(l[1].replace(";","")) if line == None: print('no matches found') - print(rel_files) + #print(rel_files) # fullchain_pem_files = [file for file in files if file.lower() == "fullchain.pem"] @@ -45,7 +45,7 @@ def check_and_write_cert_info(directory_path, output_json_path): fullchain_pem_file = fullchain_pem_file.replace("/data/","/share/docker_data/nginx/data/") fullchain_pem_file = fullchain_pem_file.replace("/etc/letsencrypt/","/share/docker_data/nginx/letsencrypt/") - print(f"Checking {fullchain_pem_file}") + #print(f"Checking {fullchain_pem_file}") cert_info = get_cert_info(fullchain_pem_file) if cert_info: