Rename, sort, and safely archive exported picture and video files.
Project description
PictureArchiver
Photos ライブラリなどから書き出した写真・動画を、撮影日時ベースの名前にして archive/ と raw/ へ整理します。
ディレクトリ
parc は実行したディレクトリを写真管理用のルートとして扱います。
Pictures/
├── import/ # 書き出した処理対象ファイル
├── archive/ # JPEG/HEIC/PNG/WebP/動画の保存先
├── raw/ # RAW ファイルの保存先
└── .stage/ # apply 前の import スナップショットと適用計画
使い方
pip install picture-archiver
cd /path/to/Pictures
parc stage
parc apply
import/に写真や動画を書き出すparc stageで差分を確認する- 問題なければ
parc applyで反映する
parc stage は import/ のスナップショットを .stage/ に作り、適用予定だけを表示します。
parc apply は .stage/ の内容を archive/ と raw/ に反映します。上書きや削除される既存ファイルと、apply 後の import/ の中身はゴミ箱へ移動します。
例
次の例では、import/ に新しい写真を書き出し済みで、archive/ には同名になる古い JPEG があるとします。
Pictures/
├── import/
│ ├── IMG_0000.jpeg # 2024-05-06 12:34:56.789
│ ├── IMG_0001.heic # 2024-05-06 12:34:56.789
│ └── IMG_0000.cr2 # 2024-05-06 12:34:56.789
├── archive/
│ └── 2024/
│ └── 2024-05-06/
│ └── 20240506_123456_789.jpeg # IMG_0000.jpeg で置き換える
└── raw/
parc stage を実施すると次のような確認が出力されます。
$ parc stage
Staged changes:
Archive:
overwrite 2024/2024-05-06/20240506_123456_789.jpeg (from import/IMG_0000.jpeg)
add 2024/2024-05-06/20240506_123456_789.heic
Raw:
add canon cr2/20240506_123456_789.cr2
No files changed yet. Apply with: parc apply
この時点では archive/ と raw/ はまだ変わっていません。
overwrite が出たら、import/IMG_0000.jpeg と archive/2024/2024-05-06/20240506_123456_789.jpeg を見比べてください。画像の中身、ファイルサイズ、撮影日時などを確認し、置き換えたくない場合は import/ から IMG_0000.jpeg を外して parc stage をやり直します。置き換えてよい場合は、そのまま parc apply を実行します。
parc apply で反映すると次のようになります。
Pictures/
├── import/
├── archive/
│ └── 2024/
│ └── 2024-05-06/
│ ├── 20240506_123456_789.jpeg
│ └── 20240506_123456_789.heic
└── raw/
└── canon cr2/
└── 20240506_123456_789.cr2
置き換え前の JPEG はゴミ箱へ移動されます。
表示の意味
add: 新規追加overwrite: import したファイルが既存の同名ファイルを置き換える
オプション
parc stage --replace # stage を作り直す
parc stage --apply # stage後に続けて apply する
ルートや各ディレクトリを明示する場合:
export PA_ROOT=/path/to/Pictures
export PA_IMPORT_DIR=/path/to/import
export PA_ARCHIVE_DIR=/path/to/archive
export PA_RAW_DIR=/path/to/raw
export PA_STAGE_ROOT=/path/to/stage
整理ルール
import/ にあるファイルは、撮影日時から yyyymmdd_HHMMSS_mmm.ext 形式へリネームされます。
- JPEG/HEIC/PNG/WebP/動画:
archive/年/年-月-日/ - RAW:
raw/RAW形式/
同じ日付の archive/2024/2024-05-06 イベント名/ のようなフォルダがすでにある場合は、新しく 2024-05-06/ を作らず、そのイベント名付きフォルダに追加します。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file picture_archiver-0.1.6.tar.gz.
File metadata
- Download URL: picture_archiver-0.1.6.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02537fa268013e614091d5bc9d02ba50e6e628ef831c42baf538d0439f2bf0a3
|
|
| MD5 |
58e2b1c0319055bab880574bb55f5c9f
|
|
| BLAKE2b-256 |
17d73ec73066d515b7cb7ed86457209c8aceab34f69f035fd2da9a1ba0868f89
|
Provenance
The following attestation bundles were made for picture_archiver-0.1.6.tar.gz:
Publisher:
publish.yml on Ryota-Nitto/PictureArchiver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
picture_archiver-0.1.6.tar.gz -
Subject digest:
02537fa268013e614091d5bc9d02ba50e6e628ef831c42baf538d0439f2bf0a3 - Sigstore transparency entry: 1795876886
- Sigstore integration time:
-
Permalink:
Ryota-Nitto/PictureArchiver@f1e3d5f8e36ca8a3138106b61064aa618be2b998 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ryota-Nitto
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1e3d5f8e36ca8a3138106b61064aa618be2b998 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file picture_archiver-0.1.6-py3-none-any.whl.
File metadata
- Download URL: picture_archiver-0.1.6-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fccd17932cf589e971d2a792e4616b4904d6fcc999896828343b73207d5f8fa
|
|
| MD5 |
868d98972951cea01013429794ead6b8
|
|
| BLAKE2b-256 |
2fb6e953697255860cb096d10c94773d5225c1f3dfa9d5341ffb82f45d13a273
|
Provenance
The following attestation bundles were made for picture_archiver-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on Ryota-Nitto/PictureArchiver
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
picture_archiver-0.1.6-py3-none-any.whl -
Subject digest:
8fccd17932cf589e971d2a792e4616b4904d6fcc999896828343b73207d5f8fa - Sigstore transparency entry: 1795877208
- Sigstore integration time:
-
Permalink:
Ryota-Nitto/PictureArchiver@f1e3d5f8e36ca8a3138106b61064aa618be2b998 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Ryota-Nitto
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f1e3d5f8e36ca8a3138106b61064aa618be2b998 -
Trigger Event:
workflow_dispatch
-
Statement type: