feat: 更新可执行文件构建工作流,添加 Windows 和 macOS 支持,并修改依赖版本

This commit is contained in:
nymiro
2025-10-23 21:01:46 +13:00
parent 3d63404c51
commit 2658bb97a2
11 changed files with 211 additions and 6 deletions
@@ -0,0 +1,82 @@
name: Build Samsung Live Photo binaries
on:
workflow_dispatch:
push:
paths:
- "scripts/samsung_to_live_photo.py"
- "packaging/**"
- ".github/workflows/build_samsung_to_live_photo.yml"
- "pyproject.toml"
jobs:
build-windows:
name: Windows executable
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[full]" pyinstaller
- name: Build Windows binary
run: |
pyinstaller --noconfirm --onefile --name SamsungToLivePhoto --collect-all pillow_heif --collect-all pyheic_struct scripts/samsung_to_live_photo.py
- name: Prepare artifact
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path packaged | Out-Null
Copy-Item -Path dist/SamsungToLivePhoto.exe -Destination packaged/
Copy-Item -Path packaging/README_windows.txt -Destination packaged/README.txt
Compress-Archive -Path packaged/* -DestinationPath SamsungToLivePhoto-win.zip
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: SamsungToLivePhoto-windows
path: SamsungToLivePhoto-win.zip
build-macos:
name: macOS executable
runs-on: macos-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install ".[full]" pyinstaller
- name: Build macOS binary
run: |
pyinstaller --noconfirm --onefile --name SamsungToLivePhoto --collect-all pillow_heif --collect-all pyheic_struct scripts/samsung_to_live_photo.py
- name: Prepare artifact
run: |
mkdir -p packaged
cp dist/SamsungToLivePhoto packaged/SamsungToLivePhoto
cp packaging/README_macos.txt packaged/README.txt
tar -czf SamsungToLivePhoto-macos.tar.gz -C packaged .
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: SamsungToLivePhoto-macos
path: SamsungToLivePhoto-macos.tar.gz
+1 -1
View File
@@ -1 +1 @@
python3
/usr/bin/python3
+1 -1
View File
@@ -1 +1 @@
/usr/bin/python3
python
+1 -1
View File
@@ -1 +1 @@
python3
python
+24
View File
@@ -37,6 +37,30 @@ pip install -e .[full]
---
### Windows & macOS standalone binaries
Need an executable without Python? Trigger the **Build Samsung Live Photo binaries** workflow in GitHub Actions (or wait for an automatic run) and download the `SamsungToLivePhoto-windows` / `SamsungToLivePhoto-macos` artifacts. Each archive ships with a short README that mirrors `packaging/README_windows.txt` and `packaging/README_macos.txt`.
To build locally on the target OS:
```bash
# Windows (PowerShell)
python -m pip install ".[full]" pyinstaller
pyinstaller --noconfirm --onefile --name SamsungToLivePhoto `
--collect-all pillow_heif --collect-all pyheic_struct `
scripts/samsung_to_live_photo.py
# macOS (bash/zsh)
python3 -m pip install ".[full]" pyinstaller
pyinstaller --noconfirm --onefile --name SamsungToLivePhoto \
--collect-all pillow_heif --collect-all pyheic_struct \
scripts/samsung_to_live_photo.py
```
The resulting executables live under `dist/`: `SamsungToLivePhoto.exe` on Windows and `SamsungToLivePhoto` on macOS.
---
## Quick Start
### CLI conversion
+27
View File
@@ -60,6 +60,33 @@ pip install -e .[full]
---
### Windows/macOS 一键可执行程序
如果希望直接在 Windows 或 macOS 上使用单独的可执行文件,可以:
- 在 GitHub Actions 中运行 **Build Samsung Live Photo binaries** 工作流(或等待自动触发),在构建完成后下载 `SamsungToLivePhoto-windows` / `SamsungToLivePhoto-macos` 构件;
- 解压后按照压缩包内的 `README.txt` 操作即可(文件位于仓库的 `packaging/README_windows.txt``packaging/README_macos.txt`)。
若想自行本地打包,可在目标系统直接执行:
```bash
# Windows (PowerShell)
python -m pip install ".[full]" pyinstaller
pyinstaller --noconfirm --onefile --name SamsungToLivePhoto `
--collect-all pillow_heif --collect-all pyheic_struct `
scripts/samsung_to_live_photo.py
# macOS (bash/zsh)
python3 -m pip install ".[full]" pyinstaller
pyinstaller --noconfirm --onefile --name SamsungToLivePhoto \
--collect-all pillow_heif --collect-all pyheic_struct \
scripts/samsung_to_live_photo.py
```
打包完成后,可执行文件会出现在 `dist/` 目录。Windows 版本为 `SamsungToLivePhoto.exe`macOS 版本为 `SamsungToLivePhoto`
---
## 快速开始:把三星动态照片变成 Live Photo
### 1. 准备样例
+44
View File
@@ -0,0 +1,44 @@
SamsungToLivePhotomacOS 版)
==============================
该压缩包包含一个通过 PyInstaller 构建的可执行文件 `SamsungToLivePhoto`,用于将三星运动照片转换成 Apple Live PhotoHEIC + MOV)。
使用方式
--------
1. 解压 `SamsungToLivePhoto-macos.tar.gz`,例如:
```bash
tar -xzf SamsungToLivePhoto-macos.tar.gz
```
解压后会得到 `SamsungToLivePhoto` 可执行文件。
2. 首次从网络下载的文件可能被标记为隔离,可运行:
```bash
xattr -dr com.apple.quarantine SamsungToLivePhoto
```
3. 确保已安装 [ExifTool](https://exiftool.org/)。在 macOS 上可通过 Homebrew 安装:
```bash
brew install exiftool
```
若不需要向 MOV 写入 ContentIdentifier,可在命令中添加 `--skip-mov-tag`。
4. 在终端中执行:
```bash
./SamsungToLivePhoto /path/to/motion_photo.HEIC --output-dir /path/to/output
```
常见选项
--------
- `--heic-name` / `--mov-name`:自定义输出文件名。
- `--skip-mov-tag`:跳过对 MOV 写入 ContentIdentifier(无需 ExifTool)。
注意事项
--------
- 该工具为命令行程序,需要在终端中运行。
- 若运行时报错缺少动态库,请确认压缩包完整解压且未被安全工具隔离。*** End Patch
+28
View File
@@ -0,0 +1,28 @@
SamsungToLivePhotoWindows 版)
================================
该压缩包包含一个通过 PyInstaller 构建的可执行文件 `SamsungToLivePhoto.exe`,用于把三星运动照片转换为 Apple Live PhotoHEIC + MOV)。
使用方式
--------
1. 解压压缩包,例如解压到 `C:\Tools\SamsungToLivePhoto`。
2. 确保已安装 [ExifTool](https://exiftool.org/)。如果不想写入 MOV 的 ContentIdentifier,可在命令中添加 `--skip-mov-tag`。
3. 打开 PowerShell 或 CMD,执行如下命令:
```
cd C:\Tools\SamsungToLivePhoto
.\SamsungToLivePhoto.exe "C:\path\to\motion_photo.HEIC" --output-dir "C:\path\to\output"
```
4. 程序会在输出目录生成 Apple 兼容的 HEIC 与 MOV 文件。
常见选项
--------
- `--heic-name` / `--mov-name`:自定义输出文件名。
- `--skip-mov-tag`:跳过对 MOV 写入 ContentIdentifier(无需 ExifTool)。
注意事项
--------
- 可执行文件首次运行可能被 Windows Defender SmartScreen 拦截,可选择“仍要运行”继续。
- 该工具为命令行程序,请在终端(PowerShell/CMD)中使用。
- 如遇到“找不到 DLL”或依赖问题,请确认压缩包完整解压且未被杀毒软件隔离。*** End Patch
+1 -1
View File
@@ -10,7 +10,7 @@ Requires-Dist: Pillow>=10.0.0
Requires-Dist: pillow-heif>=0.15.0
Requires-Dist: piexif>=1.1.3
Provides-Extra: full
Requires-Dist: exiftool-wrapper>=0.5.0; extra == "full"
Requires-Dist: exiftool-wrapper>=0.3.0; extra == "full"
# pyheic-struct
+1 -1
View File
@@ -3,4 +3,4 @@ pillow-heif>=0.15.0
piexif>=1.1.3
[full]
exiftool-wrapper>=0.5.0
exiftool-wrapper>=0.3.0
+1 -1
View File
@@ -16,7 +16,7 @@ dependencies = [
[project.optional-dependencies]
full = [
"exiftool-wrapper>=0.5.0",
"exiftool-wrapper>=0.3.0",
]
[project.scripts]