From cc95b1dfde8760471f95bec47594c44d39007b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E6=99=BA=E5=BC=BA?= Date: Thu, 20 Feb 2025 19:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=84=E5=BB=BA:=20=E6=B7=BB=E5=8A=A0PyInsta?= =?UTF-8?q?ller=E8=A7=84=E8=8C=83=E6=96=87=E4=BB=B6=E5=92=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=9E=84=E5=BB=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增竹影.spec文件用于PyInstaller构建配置 - 简化build.sh脚本,使用spec文件进行构建 - 优化DMG打包流程 - 改进依赖项管理和资源打包 --- README.md | 17 +++++++++++++++++ build.sh | 30 ++++++++++++++++++++++++++++++ main.py | 2 +- pyproject.toml | 27 +++++++++++++++++++++++++++ requirements.txt | 1 - setup.py | 24 ++++++++++++++++++++++++ 6 files changed, 99 insertions(+), 2 deletions(-) create mode 100755 build.sh create mode 100644 pyproject.toml create mode 100644 setup.py diff --git a/README.md b/README.md index dbb331a..db95171 100644 --- a/README.md +++ b/README.md @@ -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. 选择需要处理的视频文件 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..26bdc82 --- /dev/null +++ b/build.sh @@ -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 diff --git a/main.py b/main.py index 2ebb2e3..faf9974 100644 --- a/main.py +++ b/main.py @@ -366,7 +366,7 @@ def 执行翻译(self) -> None: return # 显示进度条 - self.进度条["value"] = 0 + self.状态标签["text"] = "正在翻译..." self.根窗口.update() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e0482dd --- /dev/null +++ b/pyproject.toml @@ -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 = [] diff --git a/requirements.txt b/requirements.txt index beacdd8..c5ef5ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..227e85a --- /dev/null +++ b/setup.py @@ -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", + } + } + } +)