fix: Ausgabedateinamen vereinheitlichen – Titel ohne Unterstriche

safe_output_stem und get_pvd_filename nutzten unterschiedliche Logik,
sodass MP4 und MOV-Dateien inkonsistente Titel hatten. Neue gemeinsame
Funktion extract_title stellt sicher, dass alle drei Ausgabedateien
denselben Titel ohne Unterstriche verwenden.

README und CLAUDE.md aktualisiert.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Melbar
2026-05-08 15:48:41 +02:00
parent 91e64b29fd
commit e8a553c08a
3 changed files with 142 additions and 32 deletions
+26 -28
View File
@@ -255,31 +255,6 @@ class JobPlan:
commands: list[tuple[str, list[str]]]
def get_pvd_filename(input_path: str) -> str:
"""TITEL-EXTRAKTION (Blu-ray / ProRes / DVD)."""
path = Path(input_path)
path_parts = [p.upper() for p in path.parts]
if "BDMV" in path_parts:
bdmv_index = path_parts.index("BDMV")
try:
project_folder = path_parts[bdmv_index - 4]
except IndexError:
project_folder = path_parts[bdmv_index - 1] if bdmv_index > 0 else "UNKNOWN"
clean_name = re.sub(r"^BEST_", "", project_folder, flags=re.IGNORECASE)
words = [w.capitalize() for w in clean_name.split("_") if w.strip()]
extracted_title = "".join(words)
else:
extracted_title = strip_audio_tokens(path.stem)
extracted_title = re.sub(r"[^A-Za-z0-9]", "", extracted_title)
if not extracted_title:
extracted_title = "UNKNOWN_TITLE"
return f"{extracted_title}_DEU20_PVD.mp4"
def strip_audio_tokens(stem: str) -> str:
cleaned = stem
token_pattern = re.compile(r"(?i)(^|[_\-\s])([A-Z]{3}[1-8][0-9])(?=$|[_\-\s])")
@@ -292,10 +267,33 @@ def strip_audio_tokens(stem: str) -> str:
return cleaned or stem
def extract_title(input_path: str) -> str:
"""Extrahiert den Titel einheitlich für alle Ausgabedateien (Blu-ray / ProRes / DVD)."""
path = Path(input_path)
path_parts = [p.upper() for p in path.parts]
if "BDMV" in path_parts:
bdmv_index = path_parts.index("BDMV")
try:
project_folder = path_parts[bdmv_index - 4]
except IndexError:
project_folder = path_parts[bdmv_index - 1] if bdmv_index > 0 else "UNKNOWN"
clean_name = re.sub(r"^BEST_", "", project_folder, flags=re.IGNORECASE)
words = [w.capitalize() for w in clean_name.split("_") if w.strip()]
title = "".join(words)
else:
title = strip_audio_tokens(path.stem)
title = re.sub(r"[^A-Za-z0-9]", "", title)
return title or "UNKNOWN_TITLE"
def get_pvd_filename(input_path: str) -> str:
return f"{extract_title(input_path)}_DEU20_PVD.mp4"
def safe_output_stem(input_path: str) -> str:
stem = strip_audio_tokens(Path(input_path).stem)
stem = re.sub(r"[^A-Za-z0-9]+", "_", stem).strip("_")
return stem or "UNKNOWN_TITLE"
return extract_title(input_path)
def probe_metadata(filepath: str) -> dict: