Skip to main content

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 前の作業コピー

使い方

pip install picture-archiver

cd /path/to/Pictures
parc stage
parc apply
  1. import/ に写真や動画を書き出す
  2. parc stage で差分を確認する
  3. 問題なければ parc apply で反映する

parc stageimport/ のファイルを .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
==> Preparing stage
Stage prepared.
==> Archiving import
Processed 3 import file(s).
==> Review
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.jpegarchive/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 したファイルが既存の同名ファイルを置き換える
  • update: stage と archive/raw の同じパスに差分がある
  • delete: archive/raw から削除される

オプション

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

picture_archiver-0.1.3.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picture_archiver-0.1.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file picture_archiver-0.1.3.tar.gz.

File metadata

  • Download URL: picture_archiver-0.1.3.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for picture_archiver-0.1.3.tar.gz
Algorithm Hash digest
SHA256 fc005d0960db7150c56cfb140f312e04c946e87032b0dd2c1cd97cbbf200637b
MD5 1b7c0f367614c62ddc4d18904618263d
BLAKE2b-256 9ee59f837e645495e29b188998261d1c9ea1138fdfade0de52248cbe2db8cdc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for picture_archiver-0.1.3.tar.gz:

Publisher: publish.yml on Ryota-Nitto/PictureArchiver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file picture_archiver-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for picture_archiver-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19cef932a6be799f267a2d12d41ac17caa1ad7f23f0740c93a05199e23d47352
MD5 d9b407b1518639ae6af8b6defae0d6b9
BLAKE2b-256 d3170324fb9ef6b8954f2959651dc888fc5cabc66b2b0c92d9602c146d0c0106

See more details on using hashes here.

Provenance

The following attestation bundles were made for picture_archiver-0.1.3-py3-none-any.whl:

Publisher: publish.yml on Ryota-Nitto/PictureArchiver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page