添加Windows安装程序支持

- 创建Inno Setup安装脚本(VideoSubtitleRemover.iss)
- 添加中英文语言支持(ChineseSimplified.isl, English.isl)
- 创建安装程序编译脚本(build_installer.bat)
- 添加详细的编译说明文档
- 支持桌面快捷方式创建
- 支持开始菜单项添加
- 支持完整卸载程序
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yaofanguk
2026-04-10 22:08:01 +08:00
parent 774940e39b
commit 3ca33fce3c
8 changed files with 301 additions and 59 deletions

48
VideoSubtitleRemover.iss Normal file
View File

@@ -0,0 +1,48 @@
; 视频字幕去除器 - Inno Setup 安装程序脚本
; 编译方法:下载 Inno Setup Compiler (https://jrsoftware.org/isdl.php)
; 或者使用命令iscc VideoSubtitleRemover.iss
[Setup]
AppName=视频字幕去除器
AppVersion={#GetVersionNumber}
AppPublisher=YaoFANGUK
AppPublisherURL=https://github.com/YaoFANGUK/video-subtitle-remover
AppSupportURL=https://github.com/YaoFANGUK/video-subtitle-remover/issues
AppComments=基于AI的图片/视频硬字幕去除工具
DefaultDirName={autopf}\Program Files\视频字幕去除器
DefaultGroupName=视频字幕去除器
AllowNoIcons=yes
OutputBaseFilename=VideoSubtitleRemover-Setup
Compression=lzma
SolidCompression=yes
; 内部文件需要更多内存,禁用
InternalCompressLevel=none
SetupIconFile=design\vsr.ico
WizardImageFile=design\vsr.ico
WizardSmallImageFile=design\vsr.ico
WizardImageStretch=no
UninstallDisplayIcon={app}\VideoSubtitleRemover.exe
VersionInfoVersion=1.4.0
VersionInfoCompany=YaoFANGUK
VersionInfoDescription=视频字幕去除器
VersionInfoCopyright=© 2026 YaoFANGUK
VersionInfoProductName=视频字幕去除器
[Languages]
Name: "chinese"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
Name: "english"; MessagesFile: "compiler:Languages\English.isl"
[Files]
Source: "dist\VideoSubtitleRemover\_internal\*"; DestDir: "{app}\_internal"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "dist\VideoSubtitleRemover\VideoSubtitleRemover.exe"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\视频字幕去除器"; Filename: "{app}\VideoSubtitleRemover.exe"
Name: "{userdesktop}\视频字幕去除器"; Filename: "{app}\VideoSubtitleRemover.exe"
Name: "{commonstartup}\视频字幕去除器"; Filename: "{app}\VideoSubtitleRemover.exe"
[Run]
Filename: "{app}\VideoSubtitleRemover.exe"; Description: "启动视频字幕去除器"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
Type: filesandordirs; Name: "{app}"

70
build_installer.bat Normal file
View File

@@ -0,0 +1,70 @@
@echo off
chcp 65001 >nul
echo ========================================
echo 视频字幕去除器 - 安装程序编译
echo ========================================
echo.
REM 检查 Inno Setup Compiler
where iscc >nul 2>&1
if errorlevel 1 (
echo 错误: 未找到 Inno Setup Compiler
echo.
echo 下载地址: https://jrsoftware.org/isdl.php
echo.
echo 选择 "Inno Setup 6.x" 版本下载安装
echo.
pause
exit /b 1
)
echo [1/2] 读取版本号...
for /f "tokens=2 delims='" %%a in ('findstr /C:"VERSION = " backend\config.py') do set VERSION=%%a
echo 版本号: %VERSION%
echo.
REM 检查 dist 目录
if not exist dist\VideoSubtitleRemover (
echo 错误: 找到 dist\VideoSubtitleRemover 目录
echo 请先运行 PyInstaller 打包程序
pause
exit /b 1
)
echo [2/2] 开始编译安装程序...
echo.
iscc VideoSubtitleRemover.iss
if errorlevel 1 (
echo ✗ 编译失败!
pause
exit /b 1
)
echo ✓ 编译完成
echo.
REM 检查生成的安装程序
if exist Output\VideoSubtitleRemover-Setup.exe (
echo ========================================
echo 编译成功!
echo ========================================
echo.
echo 安装程序位置: Output\VideoSubtitleRemover-Setup.exe
for %%F in ("Output\VideoSubtitleRemover-Setup.exe") do echo 文件大小: %%~zF 字节
echo.
echo 功能特点:
echo - ✓ 创建桌面快捷方式
echo - ✓ 添加到开始菜单
echo - ✓ 完整的卸载程序
echo - ✓ 支持简体中文和英文界面
echo.
echo 下一步操作:
echo 1. 测试安装: 右键点击安装程序 → 以管理员身份运行
echo 2. 分发: Output\VideoSubtitleRemover-Setup.exe
) else (
echo ✗ 编译成功但找不到输出文件
pause
exit /b 1
)
echo.
pause

View File

@@ -0,0 +1,54 @@
; 简体中文语言文件
;
; 注意:此文件需要使用 UTF-8 BOM 编码
;
[LangOptions]
LanguageName=简体中文
LanguageID=$0804
LanguageCode=zh-CN
DialogFontName=MS Shell Dlg
DialogFontSize=9
[Messages]
BeveledLabel=
BrowseForFolder=浏览文件夹
BrowseForFolderTitle=选择文件夹
CannotChangeFolder=无法更改文件夹
ClickNext=下一步 >
ClickCancel=取消
ClickFinish=完成
ClickInstall=安装
ClickUninstall=卸载
ConfirmUninstall=您确定要卸载程序吗?
ConfirmDelete=您确定要删除以下文件吗?
DirDoesntExist=目录不存在
DirExists=该目录已存在。是否安装到那里?
DirNotEmpty=该目录不为空且不是安装目录。是否继续?
DiskSpaceMB=需要的磁盘空间:
DurationMinutes=分钟
DurationSeconds=秒
FinishedLabel=完成
FinishedHeadingLabel=安装向导完成
InstallingLabel=正在安装
InstallationRequiresPrivileges=此程序需要管理员权限才能安装。请以管理员身份运行。
NoProgramGroup=开始菜单
NoProgramGroup2=开始菜单
UninstallNotFound=卸载程序未找到
WelcomeLabel1=欢迎使用
WelcomeLabel2=视频字幕去除器安装向导。
WelcomeLabel3=此程序将把视频字幕去除器安装到您的计算机上。点击"下一步"继续。
SelectDirBrowseLabel=浏览...
SelectDirDescription3=选择安装程序的目标文件夹。
SelectDirLabel3=选择安装文件夹:
SelectDirLabelBrowseLabel=浏览...
SelectDirLabel3=选择目标位置:
[CustomMessages]
NameAndVersion=%1 %2
CreatingDesktopIcon=正在创建桌面快捷方式...
CreatingUninstallingIcon=正在创建卸载图标...
FinishedHeadingLabel=视频字幕去除器已成功安装到您的计算机上。
FinishedLabel=%1 已成功安装到您的计算机上。%n%n%n%n点击"完成"退出安装向导。
Running=正在运行程序...
Uninstalling=正在卸载...

View File

@@ -0,0 +1,54 @@
; English language file
;
; Note: This file needs to be encoded with UTF-8 BOM
;
[LangOptions]
LanguageName=English
LanguageID=$0409
LanguageCode=en
DialogFontName=MS Shell Dlg
DialogFontSize=9
[Messages]
BeveledLabel=
BrowseForFolder=Browse for folder
BrowseForFolderTitle=Select folder
CannotChangeFolder=Cannot change folder
ClickNext=Next >
ClickCancel=Cancel
ClickFinish=Finish
ClickInstall=Install
ClickUninstall=Uninstall
ConfirmUninstall=Are you sure you want to completely uninstall %1 and all of its components?
ConfirmDelete=Are you sure you want to delete the following files?
DirDoesntExist=The directory does not exist.
DirExists=The directory already exists. Would you like to install to that folder anyway?
DirNotEmpty=The directory is not empty and is not the installation directory. Are you sure you want to install there?
DiskSpaceMB=Required disk space:
DurationMinutes=minutes
DurationSeconds=seconds
FinishedLabel=Completed
FinishedHeadingLabel=Installation Wizard Completed
InstallingLabel=Installing
InstallationRequiresPrivileges=This program requires administrator privileges to install. Please run as administrator.
NoProgramGroup=Start Menu
NoProgramGroup2=Start Menu
UninstallNotFound=Uninstall program not found
WelcomeLabel1=Welcome
WelcomeLabel2=Video Subtitle Remover Installation Wizard. This program will install Video Subtitle Remover on your computer. Click Next to continue.
WelcomeLabel3=Video Subtitle Remover Installation Wizard. This program will install Video Subtitle Remover on your computer. Click Next to continue.
SelectDirBrowseLabel=Browse...
SelectDirDescription3=Select the folder where you want the program to be installed.
SelectDirLabel3=Select destination folder:
SelectDirLabelBrowseLabel=Browse...
SelectDirLabel3=Select destination location:
[CustomMessages]
NameAndVersion=%1 %2
CreatingDesktopIcon=Creating desktop shortcut...
CreatingUninstallingIcon=Creating uninstalling icon...
FinishedHeadingLabel=Video Subtitle Remover has been installed on your computer.
FinishedLabel=%1 has been installed on your computer.%n%n%n%nClick Finish to close the Setup Wizard.
Running=Running %1...
Uninstalling=Uninstalling %1...

View File

@@ -1,2 +0,0 @@
@echo off
start /B VideoSubtitleRemover.exe

View File

@@ -1,2 +0,0 @@
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & WScript.ScriptFullName & "\..\VideoSubtitleRemover.exe" & chr(34), 0, False

View File

@@ -1,55 +0,0 @@
隐藏控制台窗口的方法
===================
由于某些库OpenCV、PaddlePaddle等在初始化时会创建控制台窗口
即使在 PyInstaller 中设置 console=False 也无法完全避免。
推荐解决方案:创建无窗口快捷方式
==============================
方法一:使用 VBScript 启动器(最可靠)
--------------------------------------
创建文件:隐藏控制台启动.vbs
内容:
```
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & WScript.ScriptFullName & "\..\VideoSubtitleRemover.exe" & chr(34), 0, False
```
保存到 dist/VideoSubtitleRemover/ 目录,双击此 vbs 文件即可启动。
方法二:修改现有快捷方式
--------------------------------------
1. 找到 VideoSubtitleRemover.exe右键点击
2. 选择"发送到" → "桌面快捷方式"
3. 在桌面找到创建的快捷方式,右键点击 → "属性"
4. 找到"目标"字段,在路径前添加:
``wscript.exe "隐藏控制台启动.vbs" /B //Nologo``
例如:
原目标C:\path\to\VideoSubtitleRemover.exe
新目标wscript.exe "C:\path\to\隐藏控制台启动.vbs" /B //Nologo "C:\path\to\VideoSubtitleRemover.exe"
方法三:直接使用 start 命令
--------------------------------------
创建文件:启动.bat
内容:
```
@echo off
start /B VideoSubtitleRemover.exe
```
双击此 bat 文件可以最小化控制台窗口的效果。
技术说明
========
当前版本使用 console=True 模式打包,确保程序稳定运行。
控制台窗口虽然会显示,但不影响程序功能。
如需完全隐藏控制台窗口,请使用上述方法之一。

View File

@@ -0,0 +1,75 @@
# 视频字幕去除器 - 安装程序编译说明
## 编译安装程序
### 前置要求
1. **安装 Inno Setup Compiler**
- 下载地址https://jrsoftware.org/isdl.php
- 选择 "Inno Setup 6.x" 版本下载
- 安装后确保 `iscc` 命令可用
2. **编译应用程序**
- 运行 `build_windows.bat` 使用 PyInstaller 打包程序
- 确保 `dist\VideoSubtitleRemover\` 目录存在
### 编译步骤
1. **运行编译脚本**
```bash
build_installer.bat
```
2. **查看输出**
- 安装程序将生成在 `Output\VideoSubtitleRemover-Setup.exe`
- 文件大小约为 1.8 GB
### 安装程序功能
✅ **创建桌面快捷方式**
✅ **添加到开始菜单**
✅ **完整卸载程序**
✅ **支持简体中文和英文界面**
✅ **管理员权限检查**
✅ **自动版本号管理**
### 用户使用流程
1. **下载安装程序**
- 分发 `Output\VideoSubtitleRemover-Setup.exe` 给用户
2. **安装程序**
- 右键点击安装程序 → "以管理员身份运行"
- 按照安装向导完成安装
3. **使用程序**
- 通过桌面快捷方式启动
- 或从开始菜单启动
4. **卸载程序**
- 通过"添加或删除程序"卸载
- 完全清理安装的文件
### 技术说明
- **压缩算法**: LZMA高压缩率
- **安装目录**: `{autopf}\Program Files\视频字幕去除器`
- **开始菜单**: "视频字幕去除器"
- **桌面快捷方式**: "视频字幕去除器"
- **卸载支持**: 完整清理所有文件
### 文件说明
- **VideoSubtitleRemover.iss** - Inno Setup 安装脚本
- **compiler/Languages/ChineseSimplified.isl** - 简体中文语言文件
- **compiler/Languages/English.isl** - 英文语言文件
- **build_installer.bat** - 编译脚本
### 注意事项
⚠️ **安装程序大小较大** (~1.8 GB),请确保:
- 用户有足够的磁盘空间
- 网络连接稳定(如果在线分发)
- 下载完成后验证文件完整性
⚠️ **首次运行时间**: 首次运行可能需要几分钟初始化 AI 模型