Add README.md with project overview, script descriptions, usage examples, requirements, and error handling for HEIC Sync

This commit is contained in:
Tiger Ren 2025-04-04 01:20:54 +08:00
parent 15720f72fb
commit 7bd1082f9c
2 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,81 @@
# HEIC Sync
A collection of scripts for managing and syncing photos from OneDrive, with special support for Live Photos.
## Overview
This repository contains a set of Python and PowerShell scripts that help with:
1. Downloading Live Photos from OneDrive
2. Syncing photos between different locations
3. Scanning photo libraries
4. Managing photo backups
## Scripts
### Python Scripts
#### `run_ps_download.py`
A Python wrapper for the PowerShell Live Photo downloader. It handles the execution of the PowerShell script with proper year/month path organization.
Usage:
```bash
# Process current month (and last month if today is the 1st)
python run_ps_download.py --base-save-to "D:\Photos\OneDrive-Photo" --base-path-to-scan "\Photos\Auto-saved"
# Process specific month (2 for last month, 3 for month before last, etc.)
python run_ps_download.py --base-save-to "D:\Photos\OneDrive-Photo" --base-path-to-scan "\Photos\Auto-saved" --months 2
```
#### `sync_task.py`
Handles syncing of photos between different locations, organizing them by year/month.
Usage:
```bash
# Sync OneDrive to Local(Backup)
python sync_task.py d:\OneDrive\Photos\Auto-saved\ D:\Photos\Auto-saved --months 1
# Sync Photo to NAS
python sync_task.py d:\OneDrive\Photos\Auto-saved\ \\tiger-nas\Multimedia\Photos\ --months 1
# Sync Local Motion to NAS
python sync_task.py D:\Photos\OneDrive-Photo\ \\tiger-nas\Multimedia\Photos\ --months 1
```
#### `scan_lib.py`
Scans a Immich library using its API. This is useful for updating your media server's photo library.
Usage:
```bash
python scan_lib.py
```
### PowerShell Scripts
#### `Download-ODLivePhotosV2.ps1`
The main script for downloading Live Photos from OneDrive. It handles authentication and downloading of both the image and video components of Live Photos.
Usage:
```powershell
.\Download-ODLivePhotosV2.ps1 -SaveTo "C:\Live Photos" -PathToScan "\Pictures\Camera Roll"
```
## Requirements
- Python 3.x
- PowerShell 5.1 or later
- Microsoft Edge WebView2 Runtime (for Live Photo downloads)
- OneDrive account with Live Photos
- Immich photo server (for library scanning)
## Notes
- The scripts are designed to work with a year/month folder structure
- Live Photo downloads require authentication through OneDrive
- Some scripts may need to be run multiple times for large libraries due to potential OneDrive API limitations
- Make sure to have sufficient storage space when downloading Live Photos, as they consist of both image and video files
## Error Handling
- The scripts include basic error handling and will skip already downloaded files
- If OneDrive services are temporarily unavailable, you can safely rerun the scripts later
- The scripts maintain the original folder structure from OneDrive

81
README_CN.md Normal file
View File

@ -0,0 +1,81 @@
# HEIC 同步工具
一套用于管理和同步 OneDrive 照片的脚本集合,特别支持 Live Photos 功能。
## 概述
本仓库包含一组 Python 和 PowerShell 脚本,用于:
1. 从 OneDrive 下载 Live Photos
2. 在不同位置之间同步照片
3. 扫描照片库
4. 管理照片备份
## 脚本说明
### Python 脚本
#### `run_ps_download.py`
PowerShell Live Photo 下载器的 Python 封装。它处理 PowerShell 脚本的执行,并按照年/月路径组织文件。
使用方法:
```bash
# 处理当前月份(如果是月初,还会处理上个月)
python run_ps_download.py --base-save-to "D:\Photos\OneDrive-Photo" --base-path-to-scan "\Photos\Auto-saved"
# 处理特定月份2表示上个月3表示上上个月以此类推
python run_ps_download.py --base-save-to "D:\Photos\OneDrive-Photo" --base-path-to-scan "\Photos\Auto-saved" --months 2
```
#### `sync_task.py`
处理不同位置之间的照片同步,按年/月组织文件。
使用方法:
```bash
# 从 OneDrive 同步到本地备份
python sync_task.py d:\OneDrive\Photos\Auto-saved\ D:\Photos\Auto-saved --months 1
# 同步照片到 NAS
python sync_task.py d:\OneDrive\Photos\Auto-saved\ \\tiger-nas\Multimedia\Photos\ --months 1
# 同步本地动态照片到 NAS
python sync_task.py D:\Photos\OneDrive-Photo\ \\tiger-nas\Multimedia\Photos\ --months 1
```
#### `scan_lib.py`
使用 Immich API 扫描媒体库。这对于更新媒体服务器的照片库很有用。
使用方法:
```bash
python scan_lib.py
```
### PowerShell 脚本
#### `Download-ODLivePhotosV2.ps1`
用于从 OneDrive 下载 Live Photos 的主要脚本。它处理身份验证和 Live Photos 的图像及视频组件的下载。
使用方法:
```powershell
.\Download-ODLivePhotosV2.ps1 -SaveTo "C:\Live Photos" -PathToScan "\Pictures\Camera Roll"
```
## 系统要求
- Python 3.x
- PowerShell 5.1 或更高版本
- Microsoft Edge WebView2 运行时(用于 Live Photos 下载)
- 具有 Live Photos 功能的 OneDrive 账户
- Immich 照片服务器(用于库扫描)
## 注意事项
- 脚本设计为使用年/月文件夹结构
- Live Photos 下载需要通过 OneDrive 进行身份验证
- 对于大型库,由于 OneDrive API 的限制,某些脚本可能需要运行多次
- 下载 Live Photos 时请确保有足够的存储空间,因为它们包含图像和视频文件
## 错误处理
- 脚本包含基本的错误处理,会跳过已下载的文件
- 如果 OneDrive 服务暂时不可用,您可以稍后安全地重新运行脚本
- 脚本会保持与 OneDrive 相同的原始文件夹结构