Skip to content

Commit c7ad863

Browse files
committed
Add desktop GUI entry point
1 parent 8dab2ad commit c7ad863

6 files changed

Lines changed: 674 additions & 1 deletion

File tree

.github/workflows/build-and-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: python -m pip install -r requirements-build.txt
4343

4444
- name: Build executable
45-
run: pyinstaller --onefile --clean --name VideoMergingTool --collect-all typer --collect-all click --collect-all rich main.py
45+
run: pyinstaller --onefile --clean --name VideoMergingTool --collect-all typer --collect-all click --collect-all rich --hidden-import videomerge.gui --hidden-import tkinter main.py
4646

4747
- name: Prepare artifact on Windows
4848
if: runner.os == 'Windows'

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,24 @@
2323

2424
Windows PowerShell 示例:
2525

26+
```powershell
27+
.\VideoMergingTool.exe gui
28+
```
29+
30+
也可以直接使用命令行:
31+
2632
```powershell
2733
.\VideoMergingTool.exe merge "F:\Videos" --mode fast
2834
```
2935

3036
macOS / Linux 示例:
3137

38+
```bash
39+
./VideoMergingTool gui
40+
```
41+
42+
命令行方式:
43+
3244
```bash
3345
./VideoMergingTool merge ~/Videos --mode fast
3446
```
@@ -53,6 +65,14 @@ pip install -r requirements.txt
5365

5466
## 基本用法
5567

68+
启动 GUI:
69+
70+
```bash
71+
python main.py gui
72+
```
73+
74+
CLI 合并:
75+
5676
```bash
5777
python main.py merge /path/to/input --mode fast
5878
```

scripts/build_local.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ rm -rf build
1818
--collect-all typer \
1919
--collect-all click \
2020
--collect-all rich \
21+
--hidden-import videomerge.gui \
22+
--hidden-import tkinter \
2123
main.py
2224

2325
echo

scripts/build_windows.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ if (Test-Path "build") {
2525
--collect-all typer `
2626
--collect-all click `
2727
--collect-all rich `
28+
--hidden-import videomerge.gui `
29+
--hidden-import tkinter `
2830
main.py
2931

3032
Write-Host ""

videomerge/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ def root() -> None:
2626
"""Local batch video merging tool powered by FFmpeg."""
2727

2828

29+
@app.command()
30+
def gui() -> None:
31+
"""Launch the desktop GUI."""
32+
try:
33+
from .gui import launch_gui
34+
35+
launch_gui()
36+
except RuntimeError as exc:
37+
typer.echo(str(exc), err=True)
38+
raise typer.Exit(code=1) from exc
39+
40+
2941
@app.command()
3042
def merge(
3143
input_dir: Path = typer.Argument(..., help="Directory containing videos to merge."),

0 commit comments

Comments
 (0)