Alle UNICODE Characters zu ASCII verändert
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
# PPTX Image Compressor (CaesiumCLT only)
|
# PPTX Image Compressor (CaesiumCLT only)
|
||||||
**Version 1.1.2**
|
**Version 1.1.3**
|
||||||
|
|
||||||
Dieses Paket enthält:
|
Dieses Paket enthält:
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
PPTX Grafik-Komprimier-Tool (nur CaesiumCLT, Multi-Thread, Batch, sauberes Cleanup)
|
PPTX Grafik-Komprimier-Tool (nur CaesiumCLT, Multi-Thread, Batch, sauberes Cleanup)
|
||||||
Version: 1.1.2
|
Version: 1.1.3
|
||||||
|
|
||||||
|
|
||||||
Highlights:
|
Highlights:
|
||||||
@@ -12,9 +12,8 @@ Highlights:
|
|||||||
- Log: image_name,size_before,size_after,saving,saving_percent
|
- Log: image_name,size_before,size_after,saving,saving_percent
|
||||||
- Summary inkl. Zeit benötigt
|
- Summary inkl. Zeit benötigt
|
||||||
|
|
||||||
Änderungen in 1.1.2:
|
Änderungen in 1.1.3:
|
||||||
- Batch Mode hinzugefügt
|
- Changed all UNICODE Chars to ASCII
|
||||||
- Shellscript-Fix (Store-Alias vermeiden) und Doku-Anpassungen
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -32,7 +31,7 @@ from datetime import timedelta
|
|||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
__version__ = "1.1.2"
|
__version__ = "1.1.3"
|
||||||
|
|
||||||
ALLOWED_EXT = {".jpg", ".jpeg", ".png", ".webp", ".gif"} # GIF wird übersprungen
|
ALLOWED_EXT = {".jpg", ".jpeg", ".png", ".webp", ".gif"} # GIF wird übersprungen
|
||||||
PROGRESS_BAR_LEN = 40
|
PROGRESS_BAR_LEN = 40
|
||||||
@@ -89,7 +88,7 @@ def which(cmd: str):
|
|||||||
def compress_with_caesium(original: Path, out_dir: Path, caesium_threads: int | None, quality: int) -> Path | None:
|
def compress_with_caesium(original: Path, out_dir: Path, caesium_threads: int | None, quality: int) -> Path | None:
|
||||||
exe = which("caesiumclt")
|
exe = which("caesiumclt")
|
||||||
if not exe:
|
if not exe:
|
||||||
raise RuntimeError("❌ 'caesiumclt' wurde nicht gefunden. Bitte CaesiumCLT installieren und in PATH verfügbar machen.")
|
raise RuntimeError("[ERROR] 'caesiumclt' wurde nicht gefunden. Bitte CaesiumCLT installieren und in PATH verfügbar machen.")
|
||||||
out_dir.mkdir(parents=True, exist_ok=True)
|
out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
ext = original.suffix.lower()
|
ext = original.suffix.lower()
|
||||||
if ext not in {".jpg", ".jpeg", ".png", ".webp"}:
|
if ext not in {".jpg", ".jpeg", ".png", ".webp"}:
|
||||||
@@ -160,7 +159,7 @@ def process_single_deck(input_pptx: Path, output_pptx: Path, threads: int, quali
|
|||||||
images.append(f)
|
images.append(f)
|
||||||
|
|
||||||
total = len(images)
|
total = len(images)
|
||||||
print(f"🔧 {input_pptx.name}: {total} Bild(er) gefunden")
|
print(f"[Processing] {input_pptx.name}: {total} Bild(er) gefunden")
|
||||||
print_progress(0, total)
|
print_progress(0, total)
|
||||||
|
|
||||||
if not which("caesiumclt"):
|
if not which("caesiumclt"):
|
||||||
@@ -241,8 +240,8 @@ def process_single_deck(input_pptx: Path, output_pptx: Path, threads: int, quali
|
|||||||
result["ok"] = True
|
result["ok"] = True
|
||||||
|
|
||||||
savings_pct = 0.0 if size_before == 0 else round(100.0 * (size_before - size_after) / size_before, 2)
|
savings_pct = 0.0 if size_before == 0 else round(100.0 * (size_before - size_after) / size_before, 2)
|
||||||
print(f"✅ Fertig! ({input_pptx.name})")
|
print(f"[OK] Fertig! ({input_pptx.name})")
|
||||||
print("📋 Zusammenfassung ----------------")
|
print("Zusammenfassung ----------------")
|
||||||
print(" Vorher: ", human_mb(size_before), "MB")
|
print(" Vorher: ", human_mb(size_before), "MB")
|
||||||
print(" Nachher: ", human_mb(size_after), "MB")
|
print(" Nachher: ", human_mb(size_after), "MB")
|
||||||
print(" Ersparnis: ", f"{savings_pct}%")
|
print(" Ersparnis: ", f"{savings_pct}%")
|
||||||
@@ -333,7 +332,7 @@ def main():
|
|||||||
print("Threads used: ", args.threads," Threads")
|
print("Threads used: ", args.threads," Threads")
|
||||||
|
|
||||||
if args.quality < 0 or args.quality > 100:
|
if args.quality < 0 or args.quality > 100:
|
||||||
print('❌ Ungültige Qualität. Erlaubt: 0..100')
|
print('[ERROR] Ungültige Qualität. Erlaubt: 0..100')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
input_files: list[Path] = []
|
input_files: list[Path] = []
|
||||||
@@ -349,11 +348,11 @@ def main():
|
|||||||
batch_mode = len(input_files) > 1
|
batch_mode = len(input_files) > 1
|
||||||
|
|
||||||
if batch_mode and not args.output_dir:
|
if batch_mode and not args.output_dir:
|
||||||
print('❌ Batch-Modus erkannt. Bitte -O/--output-dir angeben.')
|
print('[ERROR] Batch-Modus erkannt. Bitte -O/--output-dir angeben.')
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
if not which('caesiumclt'):
|
if not which('caesiumclt'):
|
||||||
print("❌ 'caesiumclt' nicht gefunden. Bitte installieren und in PATH verfügbar machen.")
|
print("[ERROR] 'caesiumclt' nicht gefunden. Bitte installieren und in PATH verfügbar machen.")
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
overall_before = 0
|
overall_before = 0
|
||||||
@@ -364,7 +363,7 @@ def main():
|
|||||||
if batch_mode:
|
if batch_mode:
|
||||||
out_dir = Path(args.output_dir).resolve()
|
out_dir = Path(args.output_dir).resolve()
|
||||||
out_dir.mkdir(parents=True, exist_ok=True)
|
out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
print(f"🗂️ Batch: {len(input_files)} Datei(en). Output-Verzeichnis: {out_dir}")
|
print(f"Batch: {len(input_files)} Datei(en). Output-Verzeichnis: {out_dir}")
|
||||||
for src in input_files:
|
for src in input_files:
|
||||||
if not src.exists():
|
if not src.exists():
|
||||||
print(f"- Übersprungen (nicht gefunden): {src}")
|
print(f"- Übersprungen (nicht gefunden): {src}")
|
||||||
@@ -397,11 +396,11 @@ def main():
|
|||||||
|
|
||||||
if batch_mode:
|
if batch_mode:
|
||||||
|
|
||||||
print(f"====== 📊 Gesamt-Summary ======")
|
print(f"====== Gesamt-Summary ======")
|
||||||
print(f"✅ Dateien erfolgreich: {successes}")
|
print(f"[SUCCESS] Dateien erfolgreich: {successes}")
|
||||||
|
|
||||||
if failures > 0:
|
if failures > 0:
|
||||||
print(f"❌Dateien fehlgeschlagen: {failures}")
|
print(f"[FAILED] Dateien fehlgeschlagen: {failures}")
|
||||||
|
|
||||||
if overall_before > 0:
|
if overall_before > 0:
|
||||||
pct = round(100.0 * (overall_before - overall_after) / overall_before, 2)
|
pct = round(100.0 * (overall_before - overall_after) / overall_before, 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user