Make default script run with GUI if possible. Add --gui to force GUI.

This commit is contained in:
2026-06-02 23:11:08 +00:00
parent 76cd0224de
commit 2fa15132fb
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -54,9 +54,30 @@ def main() -> None:
action="append",
help=(f"Endpoint (default: localhost:{DEFAULT_PORT})."),
)
parser.add_argument(
"--gui",
action="store_true",
help="Run with GUI (fails if GUI dependencies are not installed)",
)
args = parser.parse_args()
# --listen implies server-only mode; use --gui to force GUI even with --listen.
use_gui = args.gui or not args.listen
if use_gui:
try:
from mediahive.winmain import winmain
except ImportError as exc:
if args.gui:
raise RuntimeError(
"GUI dependencies are not installed. "
"Install with: uv pip install mediahive[gui]"
) from exc
else:
winmain()
return
if args.media_folders:
roots: dict[str, str] = {}
for path in args.media_folders:
+1 -1
View File
@@ -893,7 +893,7 @@ def winmain() -> None:
nargs="?",
help="Path to the media folder (default: saved config or initial setup dialog)",
)
args = parser.parse_args()
args, _unknown = parser.parse_known_args()
_prepend_meipass_to_path()