diff --git a/README.md b/README.md index c4195a3..2d913ca 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ ``` 5. In der UI Quelle auswaehlen, analysieren und Encoding starten. -Wenn die installierte Python-Version kein Tkinter mitbringt, oeffnet das Tool automatisch Windows-Dateidialoge fuer Quelle und Ausgabeordner und zeigt die Analyse sowie das Encoding-Log in der Konsole. +Wenn die installierte Python-Version kein Tkinter mitbringt, oeffnet das Tool automatisch einen Windows-Dateidialog fuer die Quelle, verwendet `H:\VOD` als Ausgabeordner und zeigt die Analyse sowie das Encoding-Log in der Konsole. Fuer automatisierte CLI-Laeufe kann das Encoding direkt gestartet werden: diff --git a/pvd_mezzanine.py b/pvd_mezzanine.py index b5141a9..0af42d6 100644 --- a/pvd_mezzanine.py +++ b/pvd_mezzanine.py @@ -726,28 +726,24 @@ def run_no_tk_fallback() -> int: print("Tkinter ist nicht verfuegbar. Starte Drag-and-Drop-Datei direkt im CLI-Modus.") return run_cli(sys.argv[1], OUTPUT_BASE_DIR) - print("Tkinter ist nicht verfuegbar. Oeffne Windows-Dateidialoge als Fallback.") - selected = choose_paths_with_powershell() - if selected is None: + print("Tkinter ist nicht verfuegbar. Oeffne Windows-Dateidialog als Fallback.") + input_file = choose_input_with_powershell() + if input_file is None: print("Keine Quelle ausgewaehlt.") return 1 - input_file, output_dir = selected - return run_cli(input_file, output_dir) + print(f"Quelle: {input_file}") + print(f"Ausgabe: {OUTPUT_BASE_DIR}") + return run_cli(input_file, OUTPUT_BASE_DIR) -def choose_paths_with_powershell() -> tuple[str, str] | None: +def choose_input_with_powershell() -> str | None: script = r""" Add-Type -AssemblyName System.Windows.Forms $open = New-Object System.Windows.Forms.OpenFileDialog $open.Title = 'Basis-Video auswaehlen' $open.Filter = 'Video-Dateien (*.mov;*.mxf;*.mp4;*.mkv;*.ts;*.m2ts;*.vob)|*.mov;*.mxf;*.mp4;*.mkv;*.ts;*.m2ts;*.vob|Alle Dateien (*.*)|*.*' if ($open.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK) { exit 2 } -$folder = New-Object System.Windows.Forms.FolderBrowserDialog -$folder.Description = 'Ausgabeordner auswaehlen' -$folder.SelectedPath = 'H:\VOD' -if ($folder.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK) { exit 2 } Write-Output $open.FileName -Write-Output $folder.SelectedPath """ result = subprocess.run( ["powershell", "-NoProfile", "-STA", "-Command", script], @@ -758,9 +754,9 @@ Write-Output $folder.SelectedPath if result.returncode != 0: return None lines = [line.strip() for line in result.stdout.splitlines() if line.strip()] - if len(lines) < 2: + if not lines: return None - return lines[0], lines[1] + return lines[0] def main() -> int: