From c5c3215c569c0accb2538bbaf4537765358ce3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20F=C3=BCrst?= Date: Tue, 30 Aug 2022 10:00:39 +0200 Subject: [PATCH] empty-init the args variable correctly and only mark a folder as existing if it does not contain any files --- libconv.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libconv.py b/libconv.py index facb6dc..eead427 100644 --- a/libconv.py +++ b/libconv.py @@ -66,7 +66,7 @@ def cue_sheet_processor(path: str): return sheet = get_files_with_ext(path, [CUE_SHEET_EXTENSION]) - args + args = [] if (len(sheet) != 1): logging.error(f"Expected exactly one but {path} contains {len(sheet)} cue sheets - trying file processor") @@ -119,7 +119,7 @@ def metadata_from_file(filename: str) -> str: title = filename.replace(number, "") number = re.sub(r'[ ]*-[ ]*', '', number) elif re.match(r'[0-9]+\.[ ]*[.]*', filename): - logging.info(f"file {filename} matched metadata regex #2") + logging.debug(f"file {filename} matched metadata regex #2") number = re.search(r'[0-9]+\.[ ]*', filename).group() title = filename.replace(number, "") number = re.sub(r'\.[ ]*', "", number) @@ -178,10 +178,10 @@ def prepare_destination(path: str) -> Tuple[str,bool]: sub_path = path.replace(SRC_FOLDER, "") new_path = DST_FOLDER + sub_path - existing: bool = os.path.exists(new_path) - mkdir(new_path) + existing: bool = len(os.listdir(new_path)) != 0 + for img in images: img_name = img.replace(path, "") new_img_path = new_path + img_name