Skip to content

Commit

Permalink
构建: 添加PyInstaller规范文件和优化构建脚本
Browse files Browse the repository at this point in the history
- 新增竹影.spec文件用于PyInstaller构建配置
- 简化build.sh脚本,使用spec文件进行构建
- 优化DMG打包流程
- 改进依赖项管理和资源打包
  • Loading branch information
ctkqiang committed Feb 20, 2025
1 parent a99a22a commit cc95b1d
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 2 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ pip3 install -r requirements.txt
python3 main.py
````
### 安装包下载
#### macOS 用户
1. 下载 `竹影-1.0.0.dmg` 安装包
2. 双击打开 DMG 文件
3. 将竹影拖拽到"应用程序"文件夹
4. 从启动台或应用程序文件夹启动竹影
#### Windows 用户
1. 下载 `竹影-1.0.0.exe` 安装包
2. 双击运行安装程序
3. 按照安装向导提示完成安装
4. 从开始菜单或桌面快捷方式启动竹影
### 基本操作流程
1. 选择需要处理的视频文件
Expand Down
30 changes: 30 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

# Configuration
APP_NAME="竹影"
VERSION="1.0.0"

# Clean previous builds
echo "清理旧构建..."
rm -rf build dist

# Build using spec file
echo "构建应用程序..."
pyinstaller --clean 竹影.spec

# Create DMG
if [ -d "dist/${APP_NAME}.app" ]; then
echo "创建 DMG 安装包..."
create-dmg \
--volname "${APP_NAME} Installer" \
--volicon "assets/icon.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "${APP_NAME}.app" 200 190 \
--hide-extension "${APP_NAME}.app" \
--app-drop-link 600 185 \
"dist/${APP_NAME}-${VERSION}.dmg" \
"dist/${APP_NAME}.app"
fi
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def 执行翻译(self) -> None:
return

# 显示进度条
self.进度条["value"] = 0

self.状态标签["text"] = "正在翻译..."
self.根窗口.update()

Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[tool.briefcase]
project_name = "竹影"
version = "1.0.0"
bundle = "com.钟智强"
author = "钟智强"

[tool.briefcase.app.zhuying]
formal_name = "竹影"
description = "Video Transcription and Translation Tool"
sources = ["src", "main.py"]
requires = [
"opencv-python>=4.8.0",
"pillow>=10.0.0",
"sv-ttk>=2.5.0",
"ffmpeg-python>=0.2.0",
"openai-whisper>=20230918",
"moviepy>=1.0.3",
"gTTS>=2.3.2",
"googletrans>=3.1.0a0",
"jieba>=0.42.1",
"numpy>=1.24.0",
"torch>=2.0.0",
"tqdm>=4.65.0"
]

[tool.briefcase.app.zhuying.macOS]
requires = []
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ moviepy>=1.0.3
gTTS>=2.3.2
googletrans>=3.1.0a0
jieba>=0.42.1
sqlite3
numpy>=1.24.0
torch>=2.0.0
tqdm>=4.65.0
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from setuptools import setup

setup(
name="竹影",
app=['main.py'],
version='1.0.0',
setup_requires=['py2app'],
options={
'py2app': {
'argv_emulation': True,
'packages': ['PIL', 'numpy', 'cv2', 'torch', 'whisper'],
'includes': ['tkinter'],
'resources': ['assets'],
'iconfile': 'assets/icon.icns',
'plist': {
'CFBundleName': "竹影",
'CFBundleDisplayName': "竹影",
'CFBundleIdentifier': "com.钟智强.竹影",
'CFBundleVersion': "1.0.0",
'CFBundleShortVersionString': "1.0.0",
}
}
}
)

0 comments on commit cc95b1d

Please # to comment.