diff --git a/.github/workflows/build_samsung_to_live_photo.yml b/.github/workflows/build_samsung_to_live_photo.yml new file mode 100644 index 0000000..f759397 --- /dev/null +++ b/.github/workflows/build_samsung_to_live_photo.yml @@ -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 diff --git a/.venv/bin/python b/.venv/bin/python index b8a0adb..ae65fda 120000 --- a/.venv/bin/python +++ b/.venv/bin/python @@ -1 +1 @@ -python3 \ No newline at end of file +/usr/bin/python3 \ No newline at end of file diff --git a/.venv/bin/python3 b/.venv/bin/python3 index ae65fda..d8654aa 120000 --- a/.venv/bin/python3 +++ b/.venv/bin/python3 @@ -1 +1 @@ -/usr/bin/python3 \ No newline at end of file +python \ No newline at end of file diff --git a/.venv/bin/python3.12 b/.venv/bin/python3.12 index b8a0adb..d8654aa 120000 --- a/.venv/bin/python3.12 +++ b/.venv/bin/python3.12 @@ -1 +1 @@ -python3 \ No newline at end of file +python \ No newline at end of file diff --git a/docs/README.en.md b/docs/README.en.md index 272ec99..bbf6bd8 100644 --- a/docs/README.en.md +++ b/docs/README.en.md @@ -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 diff --git a/docs/README.md b/docs/README.md index 55045a5..c870d33 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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. 准备样例 diff --git a/packaging/README_macos.txt b/packaging/README_macos.txt new file mode 100644 index 0000000..b3c65e3 --- /dev/null +++ b/packaging/README_macos.txt @@ -0,0 +1,44 @@ +SamsungToLivePhoto(macOS 版) +============================== + +该压缩包包含一个通过 PyInstaller 构建的可执行文件 `SamsungToLivePhoto`,用于将三星运动照片转换成 Apple Live Photo(HEIC + 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 diff --git a/packaging/README_windows.txt b/packaging/README_windows.txt new file mode 100644 index 0000000..457624f --- /dev/null +++ b/packaging/README_windows.txt @@ -0,0 +1,28 @@ +SamsungToLivePhoto(Windows 版) +================================ + +该压缩包包含一个通过 PyInstaller 构建的可执行文件 `SamsungToLivePhoto.exe`,用于把三星运动照片转换为 Apple Live Photo(HEIC + 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 diff --git a/pyheic_struct.egg-info/PKG-INFO b/pyheic_struct.egg-info/PKG-INFO index 8eb02c3..cc36872 100644 --- a/pyheic_struct.egg-info/PKG-INFO +++ b/pyheic_struct.egg-info/PKG-INFO @@ -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 diff --git a/pyheic_struct.egg-info/requires.txt b/pyheic_struct.egg-info/requires.txt index 4e6e9f2..7c33819 100644 --- a/pyheic_struct.egg-info/requires.txt +++ b/pyheic_struct.egg-info/requires.txt @@ -3,4 +3,4 @@ pillow-heif>=0.15.0 piexif>=1.1.3 [full] -exiftool-wrapper>=0.5.0 +exiftool-wrapper>=0.3.0 diff --git a/pyproject.toml b/pyproject.toml index 96cab04..2eea196 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ dependencies = [ [project.optional-dependencies] full = [ - "exiftool-wrapper>=0.5.0", + "exiftool-wrapper>=0.3.0", ] [project.scripts]