You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
#!/usr/bin/env python3.6importloggingimportwebbrowserfromtypingimportList, OptionalimporttyperfrompyfigletimportFigletfromrichimportprint, tracebackfromrich.consoleimportConsolefromrich.ruleimportRulefromsquawk.utilsimportcore, pkg_infofromsquawk.app.transcribeimportTranscribe# TODO: Add global option to hide banner# labels: enhancementhide_banner=typer.Option(
default=False, help="Hide the title and build info on startup"
)
traceback.install()
logger=logging.getLogger(__name__)
# Init classescli_app=typer.Typer()
console=Console()
@cli_app.callback(invoke_without_command=True)defrun_without_args():
draw_banner()
print("Run [bold]squawk --help[/] for a list of commands")
defdraw_banner():
# Print CLI titlefig=Figlet(font="rectangles")
text=fig.renderText("SQUAWK")
print(text+"\n")
# Get build infobuild_info=pkg_info.get_build_info("squawk")
# Print banner dataifbuild_info["build"] =="release":
print(
f"[bold]{str(build_info['build']).capitalize()} build[/] "f"{build_info['version']} | "
)
else:
print(
f"[bold]{str(build_info['build']).capitalize()} build[/] "f"{'([green]installed[/] :package:)'ifbuild_info['installed'] else'([yellow]cloned[/] :hammer_and_wrench:)'} "f"'{build_info['version'][:7:]}'"
)
Rule()
defrun_checks():
"""Run before CLI App load."""fromsquawk.settingsimportSettingsManagerfromsquawk.utilsimportcheckssettings=SettingsManager()
# Check for any updates and inject version info into user settings.version_info=checks.check_for_updates(
github_url=settings["app"]["update_check_url"],
package_name="squawk",
)
settings.update({"version_info": version_info})
defcli_init():
draw_banner()
run_checks()
# Commands@cli_app.command()deftts():
""" Queue proxies from the currently open DaVinci Resolve timeline """# Initfromsquawk.settingsimportSettingsManagersettings=SettingsManager()
logger=logging.getLogger(__name__)
logger.setLevel(settings["app"]["loglevel"])
# End initprint("\n")
console.rule(
f"[green bold]Queuing proxies from Resolve's active timeline[/] :outbox_tray:",
align="left",
)
print("\n")
transcribe=Transcribe()
transcribe.run()
# @cli_app.command(# context_settings={"allow_extra_args": True, "ignore_unknown_options": True}# )# def celery(# ctx: typer.Context,# celery_command: List[str] = typer.Argument(..., help="A command to pass to Celery"),# ):# """# Pass commands to Celery buried in venv.# Runs `celery -A squawk.worker [celery_command]`# at the absolute location of the package's Celery executable.# Useful when the celery project is buried in a virtual environment and you want# to do something a little more custom like purge jobs from a custom queue name.# See https://docs.celeryq.dev/en/latest/reference/cli.html for proper usage.# """# # print(ctx.params["celery_command"])# print("\n")# console.rule(f"[cyan bold]Celery command :memo:", align="left")# print("\n")# subprocess.run(# [# pkg_info.get_script_from_package("celery"),# "-A",# "squawk.worker",# *celery_command,# ]# )@cli_app.command()defconfig():
"""Open user settings configuration file for editing"""fromsquawk.settingsimportSettingsManagersettings=SettingsManager()
print("\n")
console.rule(
f"[green bold]Open 'user_settings.yaml' config[/] :gear:", align="left"
)
print("\n")
# TODO: Cross platform alternative to this hack?# labels: enhancementwebbrowser.open_new(settings.user_file)
defmain():
cli_app()
if__name__=="__main__":
main()
fdfe88335b05ac33ace8be8117a871a17e762048
The text was updated successfully, but these errors were encountered:
Add global option to hide banner
context_settings={"allow_extra_args": True, "ignore_unknown_options": True}
)
def celery(
ctx: typer.Context,
celery_command: List[str] = typer.Argument(..., help="A command to pass to Celery"),
):
"""
Pass commands to Celery buried in venv.
at the absolute location of the package's Celery executable.
Useful when the celery project is buried in a virtual environment and you want
to do something a little more custom like purge jobs from a custom queue name.
"""
console.rule(f"[cyan bold]Celery command 📝", align="left")
print("\n")
[
pkg_info.get_script_from_package("celery"),
"-A",
"squawk.worker",
*celery_command,
]
)
squawk/squawk/app/cli.py
Line 15 in c88c70e
fdfe88335b05ac33ace8be8117a871a17e762048
The text was updated successfully, but these errors were encountered: