Log Entries mit Endung .log.csv und ; als delimiter, newline nach jeder Zeile korrigiert
This commit is contained in:
@@ -139,9 +139,9 @@ def process_single_deck(input_pptx: Path, output_pptx: Path, threads: int, quali
|
|||||||
work_dir = Path(tempfile.mkdtemp(prefix=TEMP_PREFIX + "work_"))
|
work_dir = Path(tempfile.mkdtemp(prefix=TEMP_PREFIX + "work_"))
|
||||||
scratch_dir = Path(tempfile.mkdtemp(prefix=TEMP_PREFIX + "scratch_"))
|
scratch_dir = Path(tempfile.mkdtemp(prefix=TEMP_PREFIX + "scratch_"))
|
||||||
|
|
||||||
log_file = output_pptx.with_suffix(".log")
|
log_file = output_pptx.with_suffix(".log.csv")
|
||||||
ensure_clean_file(log_file)
|
ensure_clean_file(log_file)
|
||||||
log_lines = ["image_name,size_before,size_after,saving,saving_percent"]
|
log_lines = ["image_name;size_before;size_after;saving;saving_percent\n"]
|
||||||
|
|
||||||
size_before = input_pptx.stat().st_size
|
size_before = input_pptx.stat().st_size
|
||||||
result["size_before"] = size_before
|
result["size_before"] = size_before
|
||||||
@@ -174,7 +174,7 @@ def process_single_deck(input_pptx: Path, output_pptx: Path, threads: int, quali
|
|||||||
if ext == ".gif":
|
if ext == ".gif":
|
||||||
with lock:
|
with lock:
|
||||||
done_count += 1
|
done_count += 1
|
||||||
log_lines.append(f"{img_path.name},{orig_size},{orig_size},0,0.0")
|
log_lines.append(f"{img_path.name};{orig_size};{orig_size};0;0.0\n")
|
||||||
print_progress(done_count, total)
|
print_progress(done_count, total)
|
||||||
return
|
return
|
||||||
chosen_size = orig_size
|
chosen_size = orig_size
|
||||||
@@ -194,7 +194,7 @@ def process_single_deck(input_pptx: Path, output_pptx: Path, threads: int, quali
|
|||||||
saving = orig_size - chosen_size
|
saving = orig_size - chosen_size
|
||||||
saving_percent = round((saving / orig_size) * 100, 2) if orig_size > 0 else 0.0
|
saving_percent = round((saving / orig_size) * 100, 2) if orig_size > 0 else 0.0
|
||||||
with lock:
|
with lock:
|
||||||
log_lines.append(f"{img_path.name},{orig_size},{chosen_size},{saving},{saving_percent}")
|
log_lines.append(f"{img_path.name};{orig_size};{chosen_size};{saving};{saving_percent}\n")
|
||||||
done_count += 1
|
done_count += 1
|
||||||
print_progress(done_count, total)
|
print_progress(done_count, total)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user