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
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.5.tar.gz (13.0 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.5-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: picture_archiver-0.1.5.tar.gz
  • Upload date:
  • Size: 13.0 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.5.tar.gz
Algorithm Hash digest
SHA256 2273237b804a2cc5269ec2cec0d71f6a78ae53170b20425f2fca17eda8d9f305
MD5 7a211c67d74d0799990b9d24ed374fb4
BLAKE2b-256 371a156cad0d172cdf767bd31d368171b4de92508483e13297b3f3a0710fd16c

See more details on using hashes here.

Provenance

The following attestation bundles were made for picture_archiver-0.1.5.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.5-py3-none-any.whl.

File metadata

File hashes

Hashes for picture_archiver-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 44449b246defa10bd151e56558c1abfc65efafabe00dbf3c079e90fc7347ef9d
MD5 ab44ec43c3d57eccd779665bd82136fb
BLAKE2b-256 c4641bd8d0e2cdbef325a560658c0f570ce68f5bb8f39b8bc1a75dff4ba173bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for picture_archiver-0.1.5-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