Browse Source

empty-init the args variable correctly and only mark a folder as existing if it does not contain any files

master
Constantin Fürst 2 years ago
parent
commit
c5c3215c56
  1. 8
      libconv.py

8
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

Loading…
Cancel
Save