kopia lustrzana https://github.com/corrscope/corrscope
CLI: Remove --write path argument, automatically generate path
If audio is present, use `audio without .wav`.yaml. If not present, default to ovgenpy.yaml.pull/357/head
rodzic
590185ae5c
commit
7eb9cea766
|
@ -27,7 +27,12 @@ OutFile = click.Path(dir_okay=False)
|
||||||
# name = possible_names[-1][1].replace('-', '_').lower()
|
# name = possible_names[-1][1].replace('-', '_').lower()
|
||||||
|
|
||||||
|
|
||||||
|
# List of recognized Config file extensions.
|
||||||
YAML_EXTS = ['.yaml']
|
YAML_EXTS = ['.yaml']
|
||||||
|
# Default extension when writing Config.
|
||||||
|
YAML_NAME = YAML_EXTS[0]
|
||||||
|
DEFAULT_CONFIG_PATH = Path('ovgenpy').with_suffix(YAML_NAME)
|
||||||
|
|
||||||
PROFILE_DUMP_NAME = 'cprofile'
|
PROFILE_DUMP_NAME = 'cprofile'
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +46,7 @@ PROFILE_DUMP_NAME = 'cprofile'
|
||||||
@click.option('--video-output', '-o', type=OutFile, help=
|
@click.option('--video-output', '-o', type=OutFile, help=
|
||||||
'Config: Output video path')
|
'Config: Output video path')
|
||||||
# Disables GUI
|
# Disables GUI
|
||||||
@click.option('--write', '-w', nargs=1, type=OutFile, help=
|
@click.option('--write', '-w', is_flag=True, help=
|
||||||
"Write config YAML file to path (don't open GUI).")
|
"Write config YAML file to path (don't open GUI).")
|
||||||
@click.option('--play', '-p', is_flag=True, help=
|
@click.option('--play', '-p', is_flag=True, help=
|
||||||
"Preview or render (don't open GUI).")
|
"Preview or render (don't open GUI).")
|
||||||
|
@ -54,7 +59,7 @@ def main(
|
||||||
audio: Optional[str],
|
audio: Optional[str],
|
||||||
video_output: Optional[str],
|
video_output: Optional[str],
|
||||||
# gui
|
# gui
|
||||||
write: Optional[str],
|
write: bool,
|
||||||
play: bool,
|
play: bool,
|
||||||
profile: bool,
|
profile: bool,
|
||||||
):
|
):
|
||||||
|
@ -142,8 +147,13 @@ def main(
|
||||||
raise OvgenError('GUI not implemented')
|
raise OvgenError('GUI not implemented')
|
||||||
else:
|
else:
|
||||||
if write:
|
if write:
|
||||||
|
if audio:
|
||||||
|
write_path = Path(audio).with_suffix(YAML_NAME)
|
||||||
|
else:
|
||||||
|
write_path = DEFAULT_CONFIG_PATH
|
||||||
|
|
||||||
# TODO test writing YAML file
|
# TODO test writing YAML file
|
||||||
yaml.dump(cfg, Path(write))
|
yaml.dump(cfg, write_path)
|
||||||
|
|
||||||
if play:
|
if play:
|
||||||
if profile:
|
if profile:
|
||||||
|
|
Ładowanie…
Reference in New Issue