diff --git a/README.md b/README.md index 912ac23..aa96c4f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # fcco Converter V2 -WAV-zu-MP3-Konverter mit grafischer Benutzeroberfläche. Unterstützt automatische Metadaten-Erstellung (Künstler, Album, Titel, Tracknummer), Cover-Bilder und alphabetische Sortierung. Läuft auf **Windows** und **macOS**. +WAV-zu-MP3-Konverter mit grafischer Benutzeroberfläche. Unterstützt automatische Metadaten-Erstellung (Künstler, Album, Titel, Tracknummer), Cover-Bilder und alphabetische Sortierung. Läuft auf Windows und macOS. --- @@ -13,16 +13,33 @@ WAV-zu-MP3-Konverter mit grafischer Benutzeroberfläche. Unterstützt automatisc - Einstellungen werden dauerhaft gespeichert - Fortschrittsanzeige pro Datei und gesamt - Automatisches Update direkt aus der App -- Moderne, dunkle Benutzeroberfläche (CustomTkinter) +- Moderne, dunkle Benutzeroberfläche + +--- + +## Automatische Titel-Extrahierung (Neu in V2.0.2) + +Das Programm erkennt Dateinamen im typischen fcco-Format und erstellt daraus automatisch saubere Songtitel (ID3-Tags). +Das Muster wird nach dem Unterstrich-Format extrahiert. Hier sind Beispiele, wie aus Dateinamen automatisch MP3-Titel gebildet werden: + +- 260719So_N_10_Predigt_D Vorname Nachname.wav -> "Predigt Vorname Nachname" +- 260719So_N_07_Vorwort_D Vorname Nachname.wav -> "Vorwort Vorname Nachname" +- 260719So_N_09_Gedicht_D Vorname Nachname.wav -> "Gedicht Vorname Nachname" +- 260719So_N_10_Predigt_D.wav -> "Predigt D" +- 260719So_N_10_Predigt_D Gast.wav -> "Predigt Gast" +- 260719So_N_06_Lied_R О пройденном я подвожу итог.wav -> "О пройденном я подвожу итог" +- 260719So_N_04_Lied_D Zum blauen Himmel.wav -> "Zum blauen Himmel" +- 260719So_N_04_Chor_D Zum blauen Himmel.wav -> "Zum blauen Himmel (Chor)" +- 260719So_N_04_Orchester_D Zum blauen Himmel.wav -> "Zum blauen Himmel (Orchester)" --- ## Installation (Endnutzer) -Lade die neueste Version von der [Releases-Seite](https://git.joelunger.de/public/fcco-Converter/releases) herunter: +Lade die neueste Version von der Releases-Seite (Gitea) herunter: -- **Windows**: `fcco-Converter-windows.zip` entpacken und `fcco-Converter.exe` starten. -- **macOS**: `fcco-Converter-macos.zip` entpacken und `fcco-Converter` starten. +- Windows: fcco-Converter-windows.zip entpacken und fcco-Converter.exe starten. +- macOS: fcco-Converter-macos.zip entpacken und fcco-Converter starten. FFmpeg wird automatisch beim ersten Start heruntergeladen. Keine weitere Installation nötig. @@ -30,66 +47,27 @@ FFmpeg wird automatisch beim ersten Start heruntergeladen. Keine weitere Install ## Updates -In der App auf **"Update prüfen"** klicken. Wenn eine neue Version verfügbar ist, wird sie direkt heruntergeladen und installiert. Danach muss die App einmal neu gestartet werden. +In der App auf "Update prüfen" klicken. Wenn eine neue Version verfügbar ist, wird sie direkt heruntergeladen und installiert. Danach muss die App einmal neu gestartet werden. --- ## Entwicklung ### Voraussetzungen - - Python 3.11 oder neuer - Virtuelle Umgebung empfohlen ### Setup - -```bash python -m venv .venv source .venv/bin/activate # macOS / Linux # .venv\Scripts\activate # Windows pip install -r requirements.txt -``` ### Starten - -```bash python main.py -``` -### Build (Standalone-Executable) - -```bash +### Build (Standalone-Executable & ZIP-Erstellung) python build.py -``` -Die fertige Datei liegt anschließend im `dist/`-Verzeichnis. - ---- - -## Projektstruktur - -``` -fcco-Converter/ -├── main.py # Einstiegspunkt -├── build.py # Build-Skript (PyInstaller) -├── requirements.txt # Abhängigkeiten -├── icon.ico # Programm-Icon -├── fcco_converter/ -│ ├── __init__.py -│ ├── config.py # Einstellungen & Konfiguration -│ ├── converter.py # FFmpeg-Konvertierung -│ ├── metadata.py # ID3-Tags & Cover -│ ├── updater.py # Auto-Update von Gitea Releases -│ └── gui.py # CustomTkinter GUI -└── README.md -``` - ---- - -## Hinweise - -- Nur `.wav`-Dateien werden als Eingabe akzeptiert. -- Cover-Bilder müssen `.jpg`, `.jpeg` oder `.png` sein. -- Export erfolgt im `.mp3`-Format (192 kbit/s). -- Einstellungen werden in `~/.config/fcco-Converter/` (Linux), `~/Library/Application Support/fcco-Converter/` (macOS) bzw. `%APPDATA%/fcco-Converter/` (Windows) gespeichert. \ No newline at end of file +Die fertige App und die Release-ZIP-Datei liegen anschließend im dist/ Verzeichnis. \ No newline at end of file diff --git a/config.json b/config.json index 410542b..49aec17 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "app_name": "fcco Converter", - "app_version": "2.0.1", + "app_version": "2.0.2", "repo_owner": "public", "repo_name": "fcco-Converter", "gitea_api_base": "https://git.joelunger.de/api/v1" diff --git a/fcco_converter/config.py b/fcco_converter/config.py index e3c220b..bb5a95c 100644 --- a/fcco_converter/config.py +++ b/fcco_converter/config.py @@ -13,7 +13,7 @@ from pathlib import Path # ---- Globale App-Informationen (aus config.json) ---- APP_INFO = { "app_name": "fcco Converter", - "app_version": "2.0.0", + "app_version": "2.0.2", "repo_owner": "public", "repo_name": "fcco-Converter", "gitea_api_base": "https://git.joelunger.de/api/v1" diff --git a/fcco_converter/converter.py b/fcco_converter/converter.py index f5ec032..642cd46 100644 --- a/fcco_converter/converter.py +++ b/fcco_converter/converter.py @@ -205,7 +205,8 @@ def convert_file_entry( audio_settings = {"output_format": "mp3", "bitrate": "192", "encoding_mode": "CBR"} file_path = Path(entry["full_path"]) - title = file_path.stem + from .metadata import extract_title_from_filename + title = extract_title_from_filename(file_path.stem) output_format = audio_settings.get("output_format", "mp3") try: diff --git a/fcco_converter/metadata.py b/fcco_converter/metadata.py index 52007bb..ab12a25 100644 --- a/fcco_converter/metadata.py +++ b/fcco_converter/metadata.py @@ -4,6 +4,7 @@ fcco-Converter V2 – Metadaten-Modul Hilfsfunktionen für ID3-Tags, Cover-Bilder und Albumname-Generierung. """ +import re from datetime import datetime from pathlib import Path @@ -51,6 +52,47 @@ def extract_event_from_folder(file_path: Path) -> tuple[str, str]: return "", "" +def extract_title_from_filename(filename: str) -> str: + """Extrahiert einen sauberen Titel aus dem komplexen Dateinamen-Format. + + Format-Erwartung: [Prefix]_[Track]_[Type]_[Lang][ Remainder] + Beispiele: + 260719So_N_10_Predigt_D Vorname Nachname -> "Predigt Vorname Nachname" + 260719So_N_04_Lied_D Zum blauen Himmel -> "Zum blauen Himmel" + """ + # Regulärer Ausdruck, um die Komponenten zu extrahieren + match = re.match(r"^.*?_\d+_(?P[a-zA-Z]+)_(?P[a-zA-Z]+)(?: (?P.*))?$", filename) + if not match: + return filename + + typ = match.group("type") + lang = match.group("lang") + remainder = match.group("remainder") or "" + + typ_lower = typ.lower() + + if typ_lower in ["predigt", "vorwort", "gedicht"]: + if remainder: + return f"{typ} {remainder}" + return f"{typ} {lang}" + + elif typ_lower == "lied": + if remainder: + return remainder + return f"{typ} {lang}" + + elif typ_lower in ["chor", "orchester"]: + if remainder: + return f"{remainder} ({typ})" + return f"{typ} {lang}" + + else: + # Fallback + if remainder: + return f"{typ} {remainder}" + return f"{typ} {lang}" + + from mutagen.id3 import ID3, APIC, TIT2, TPE1, TALB, TRCK, TDRC def apply_id3_tags(