Improve Linux terminal input and interactive path prompts
This commit is contained in:
1 parent
eb5937a629
commit
ad2b15994f
5 files changed
+190
-22
No files matched your search
Regular → Executable
+16
-8
@@ -27,9 +27,15 @@ from tools.avisynth_workspace import (
|
||||
workspace_root,
|
||||
write_workspace,
|
||||
)
|
||||
from tools.console import ProgressView, pause_if_interactive, prompt_input, prompt_yes_no
|
||||
from tools.console import (
|
||||
ProgressView,
|
||||
launch_terminal_if_needed,
|
||||
pause_if_interactive,
|
||||
prompt_input,
|
||||
prompt_yes_no,
|
||||
)
|
||||
from tools.exiftool import require_exiftool, run_exiftool_json
|
||||
from tools.filesystem import determine_working_dir
|
||||
from tools.filesystem import determine_working_dir, input_paths
|
||||
from tools.video_batch_encode import encode_validated_video_only
|
||||
from tools.video_inputs import VideoInput, collect_video_inputs
|
||||
from tools.video_options import (
|
||||
@@ -43,13 +49,13 @@ from tools.video_validation_workflow import run_validations
|
||||
|
||||
|
||||
def run(argv: list[str]) -> int:
|
||||
if len(argv) < 2:
|
||||
print("Usage: python3 video_encode.py path/to/file/or/directory [...]")
|
||||
return 2
|
||||
|
||||
try:
|
||||
working_dir = determine_working_dir(argv[1:])
|
||||
inputs = collect_video_inputs(argv[1:])
|
||||
args = input_paths(argv)
|
||||
if not args:
|
||||
print("No inputs selected.")
|
||||
return 0
|
||||
working_dir = determine_working_dir(args)
|
||||
inputs = collect_video_inputs(args)
|
||||
except RuntimeError as exc:
|
||||
print(exc)
|
||||
return 1
|
||||
@@ -364,6 +370,8 @@ def wait_for_script_edits() -> str | None:
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
if launch_terminal_if_needed(argv):
|
||||
return 0
|
||||
try:
|
||||
return run(argv)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in new issue
Block a user