Files

41 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
"""
restart.py — Restart the AI Video Upscaler web application.
Usage:
python restart.py # Restart on default port 8000
python restart.py --port 9000 # Restart on a custom port
"""
import argparse
import os
import sys
import time
# Import siblings
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, BASE_DIR)
from stop import stop
from start import start
def restart(host: str, port: int, open_browser: bool = True) -> None:
stop()
# Brief pause to let the port fully release
time.sleep(1)
start(host, port, open_browser=open_browser)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Restart the AI Video Upscaler")
parser.add_argument("--host", default="0.0.0.0",
help="Bind address (default: 0.0.0.0 to bind all interfaces, use 127.0.0.1 for local loopback only)")
parser.add_argument("--port", type=int, default=8000,
help="Port to listen on (default: 8000)")
parser.add_argument("--no-browser", action="store_true",
help="Don't open the browser automatically")
args = parser.parse_args()
restart(args.host, args.port, open_browser=not args.no_browser)