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 前の import スナップショットと適用計画

使い方

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 したファイルが既存の同名ファイルを置き換える

オプション

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.6.tar.gz (12.1 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.6-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

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

Hashes for picture_archiver-0.1.6.tar.gz
Algorithm Hash digest
SHA256 02537fa268013e614091d5bc9d02ba50e6e628ef831c42baf538d0439f2bf0a3
MD5 58e2b1c0319055bab880574bb55f5c9f
BLAKE2b-256 17d73ec73066d515b7cb7ed86457209c8aceab34f69f035fd2da9a1ba0868f89

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for picture_archiver-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 8fccd17932cf589e971d2a792e4616b4904d6fcc999896828343b73207d5f8fa
MD5 868d98972951cea01013429794ead6b8
BLAKE2b-256 2fb6e953697255860cb096d10c94773d5225c1f3dfa9d5341ffb82f45d13a273

See more details on using hashes here.

Provenance

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