Adding handoff to Victor Viral
This commit is contained in:
+8
-3
@@ -156,6 +156,11 @@ Examples:
|
|||||||
default=None,
|
default=None,
|
||||||
help="For handoff: path to video file (overrides output_video in project.json)",
|
help="For handoff: path to video file (overrides output_video in project.json)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--prod",
|
||||||
|
action="store_true",
|
||||||
|
help="Target production server (GNOMMOWEB_PROD_URL / GNOMMOWEB_PROD_API_KEY)",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@@ -218,13 +223,13 @@ Examples:
|
|||||||
return cmd_master(project_path, args.verbose, args.channel)
|
return cmd_master(project_path, args.verbose, args.channel)
|
||||||
elif action == "push":
|
elif action == "push":
|
||||||
from .push import cmd_push
|
from .push import cmd_push
|
||||||
return cmd_push(project_path, args.verbose, args.force)
|
return cmd_push(project_path, args.verbose, args.force, args.prod)
|
||||||
elif action == "pull":
|
elif action == "pull":
|
||||||
from .pull import cmd_pull
|
from .pull import cmd_pull
|
||||||
return cmd_pull(project_path, args.verbose, args.force)
|
return cmd_pull(project_path, args.verbose, args.force, args.prod)
|
||||||
elif action == "handoff":
|
elif action == "handoff":
|
||||||
from .handoff import cmd_handoff
|
from .handoff import cmd_handoff
|
||||||
return cmd_handoff(project_path, args.verbose, args.file)
|
return cmd_handoff(project_path, args.verbose, args.file, args.prod)
|
||||||
|
|
||||||
except GnommoError as e:
|
except GnommoError as e:
|
||||||
print(f"Error: {e}", file=sys.stderr)
|
print(f"Error: {e}", file=sys.stderr)
|
||||||
|
|||||||
+12
-7
@@ -65,18 +65,23 @@ def _write_sync(project_path: Path, data: dict):
|
|||||||
json.dump(data, f, indent=2)
|
json.dump(data, f, indent=2)
|
||||||
|
|
||||||
|
|
||||||
def cmd_handoff(project_path: Path, verbose: bool = False, file_override: str | None = None) -> int:
|
def cmd_handoff(project_path: Path, verbose: bool = False, file_override: str | None = None, prod: bool = False) -> int:
|
||||||
_load_env_file()
|
_load_env_file()
|
||||||
|
|
||||||
|
if prod:
|
||||||
|
api_url = os.environ.get("GNOMMOWEB_PROD_URL", "").rstrip("/")
|
||||||
|
api_key = os.environ.get("GNOMMOWEB_PROD_API_KEY", "")
|
||||||
|
if not api_url: print("Error: GNOMMOWEB_PROD_URL is not set.", file=sys.stderr); return 1
|
||||||
|
if not api_key: print("Error: GNOMMOWEB_PROD_API_KEY is not set.", file=sys.stderr); return 1
|
||||||
|
else:
|
||||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||||
|
if not api_url: print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr); return 1
|
||||||
|
if not api_key: print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr); return 1
|
||||||
|
|
||||||
if not api_url:
|
if verbose:
|
||||||
print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr)
|
target = "production" if prod else "local"
|
||||||
return 1
|
print(f" → {target}: {api_url}")
|
||||||
if not api_key:
|
|
||||||
print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
project_file = project_path / "project.json"
|
project_file = project_path / "project.json"
|
||||||
if not project_file.exists():
|
if not project_file.exists():
|
||||||
|
|||||||
+12
-7
@@ -73,18 +73,23 @@ def _parse_ts(ts_str) -> datetime | None:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def cmd_pull(project_path: Path, verbose: bool = False, force: bool = False) -> int:
|
def cmd_pull(project_path: Path, verbose: bool = False, force: bool = False, prod: bool = False) -> int:
|
||||||
_load_env_file()
|
_load_env_file()
|
||||||
|
|
||||||
|
if prod:
|
||||||
|
api_url = os.environ.get("GNOMMOWEB_PROD_URL", "").rstrip("/")
|
||||||
|
api_key = os.environ.get("GNOMMOWEB_PROD_API_KEY", "")
|
||||||
|
if not api_url: print("Error: GNOMMOWEB_PROD_URL is not set.", file=sys.stderr); return 1
|
||||||
|
if not api_key: print("Error: GNOMMOWEB_PROD_API_KEY is not set.", file=sys.stderr); return 1
|
||||||
|
else:
|
||||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||||
|
if not api_url: print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr); return 1
|
||||||
|
if not api_key: print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr); return 1
|
||||||
|
|
||||||
if not api_url:
|
if verbose:
|
||||||
print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr)
|
target = "production" if prod else "local"
|
||||||
return 1
|
print(f" → {target}: {api_url}")
|
||||||
if not api_key:
|
|
||||||
print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
project_file = project_path / "project.json"
|
project_file = project_path / "project.json"
|
||||||
if not project_file.exists():
|
if not project_file.exists():
|
||||||
|
|||||||
+12
-7
@@ -86,18 +86,23 @@ def _parse_ts(ts_str) -> datetime | None:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def cmd_push(project_path: Path, verbose: bool = False, force: bool = False) -> int:
|
def cmd_push(project_path: Path, verbose: bool = False, force: bool = False, prod: bool = False) -> int:
|
||||||
_load_env_file()
|
_load_env_file()
|
||||||
|
|
||||||
|
if prod:
|
||||||
|
api_url = os.environ.get("GNOMMOWEB_PROD_URL", "").rstrip("/")
|
||||||
|
api_key = os.environ.get("GNOMMOWEB_PROD_API_KEY", "")
|
||||||
|
if not api_url: print("Error: GNOMMOWEB_PROD_URL is not set.", file=sys.stderr); return 1
|
||||||
|
if not api_key: print("Error: GNOMMOWEB_PROD_API_KEY is not set.", file=sys.stderr); return 1
|
||||||
|
else:
|
||||||
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
api_url = os.environ.get("GNOMMOWEB_URL", "").rstrip("/")
|
||||||
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
api_key = os.environ.get("GNOMMOWEB_API_KEY", "")
|
||||||
|
if not api_url: print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr); return 1
|
||||||
|
if not api_key: print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr); return 1
|
||||||
|
|
||||||
if not api_url:
|
if verbose:
|
||||||
print("Error: GNOMMOWEB_URL is not set.", file=sys.stderr)
|
target = "production" if prod else "local"
|
||||||
return 1
|
print(f" → {target}: {api_url}")
|
||||||
if not api_key:
|
|
||||||
print("Error: GNOMMOWEB_API_KEY is not set.", file=sys.stderr)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
project_file = project_path / "project.json"
|
project_file = project_path / "project.json"
|
||||||
if not project_file.exists():
|
if not project_file.exists():
|
||||||
|
|||||||
Reference in New Issue
Block a user