-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
56 lines (42 loc) · 1.79 KB
/
Copy pathmain.py
File metadata and controls
56 lines (42 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
main.py — Main entry point for Tukdify MultiCompressor.
Supports standard GUI launch, file arguments from Explorer right-click, and --selftest for CI.
"""
from __future__ import annotations
import sys
from pathlib import Path
# Add src/ directory to sys.path
SRC = Path(__file__).resolve().parent / "src"
if str(SRC) not in sys.path:
sys.path.insert(0, str(SRC))
from compressor import __app_name__, __version__ # noqa: E402
from gui.app import run # noqa: E402
def selftest() -> int:
"""Headless self-test for CI verification."""
print(f"Running {__app_name__} v{__version__} self-test...")
from compressor import config, engine, presets
from gui import theme
# Test settings load
s = config.load_settings()
assert isinstance(s, dict), "Failed to load settings dict"
# Test preset system
p = presets.get_preset("balanced")
assert p.video_crf == 24, "Preset CRF mismatch"
# Test engine detection
assert engine.detect_kind("video.mp4") == "video", "Engine kind detection failed"
assert engine.detect_kind("photo.jpg") == "image", "Engine kind detection failed"
assert engine.detect_kind("doc.pdf") == "pdf", "Engine kind detection failed"
assert theme.BG_OBSIDIAN == "#0A0D14", "Theme background mismatch"
assert theme.BRAND_BLUE == "#2563EB", "Theme brand color mismatch"
print(f"[OK] All core self-test assertions passed for {__app_name__} v{__version__}!")
return 0
if __name__ == "__main__":
args = sys.argv[1:]
if "--version" in args or "-v" in args:
print(f"{__app_name__} v{__version__}")
sys.exit(0)
if "--selftest" in args:
sys.exit(selftest())
# Filter out flags and pass initial files to GUI
file_args = [a for a in args if not a.startswith("--")]
run(initial_files=file_args)