Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions external_plugins/photo-date-organizer/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "photo-date-organizer",
"version": "0.1.0",
"description": "Sort a messy folder of phone photos, screenshots and videos into year/month folders by the date they were taken — read from EXIF, the video's creation time or a date in the file name, with the file time only as a last resort — and optionally rename them to 20261002_091500.jpg. Every file shows where its date came from, you can correct any date, and a move can be undone. Runs locally; no API keys.",
"description_i18n": {
"en": "Sort a messy folder of phone photos, screenshots and videos into year/month folders by the date they were taken — read from EXIF, the video's creation time or a date in the file name, with the file time only as a last resort — and optionally rename them to 20261002_091500.jpg. Every file shows where its date came from, you can correct any date, and a move can be undone. Runs locally; no API keys.",
"zh-CN": "把乱七八糟的手机照片、截图和视频,按拍摄日期整理进“年/月”文件夹——日期取自 EXIF、视频创建时间或文件名里的日期,最后才用文件修改时间——还可以统一改名成 20261002_091500.jpg。每个文件都标明日期来源,日期可以手动改正,移动后还能撤销。在本地运行,无需 API 密钥。"
},
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"keywords": [
"photos",
"exif",
"date taken",
"organize",
"sort by date",
"screenshots",
"照片整理",
"按日期",
"拍摄时间",
"相册",
"归档"
],
"skills": "skills",
"mcpServers": {
"photo-date-organizer": {
"type": "stdio",
"command": "node",
"args": [
"${ZCODE_PLUGIN_ROOT}/dist/server.mjs"
],
"cwd": "${ZCODE_PROJECT_DIR}",
"timeoutMs": 900000,
"env": {
"ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}"
}
}
},
"ui": {
"surfaces": [
{
"id": "editor",
"title": {
"zh-CN": "照片按日期整理",
"en-US": "Photo Date Organizer"
},
"icon": "calendar-days",
"server": "photo-date-organizer",
"resourceUri": "ui://photo-date-organizer/panel.html",
"availability": "session"
}
]
}
}
21 changes: 21 additions & 0 deletions external_plugins/photo-date-organizer/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Penova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions external_plugins/photo-date-organizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Photo Date Organizer

Sort a messy folder of phone photos, screenshots and videos into year/month folders by the date they were taken — read from EXIF, the video's creation time or a date in the file name, with the file time only as a last resort — and optionally rename them to 20261002_091500.jpg. Every file shows where its date came from, you can correct any date, and a move can be undone. Runs locally; no API keys.

## Features

- **Real dates first**: EXIF DateTimeOriginal for JPEG/HEIC/TIFF/DNG, the MP4/MOV creation time, then dates in names (IMG_20261103_101522, Screenshot 2026-11-05 at 10.22.31, 微信图片_20261106, mmexport timestamps), and only then the file time — flagged, because copying changes it.
- **Layouts**: 2026/2026-10, 2026-10, 2026/10, 2026/2026-10-02, 2026-10-02 or no folders; keep names, rename to the date, or date + original name.
- **Fix in the table**: type a date in any format like 2024-02-02 12:00 or 2024年2月2日; the source becomes “manual”. Camera make/model is shown.
- **Safe**: same-name files get -2, -3; nothing is overwritten. Move mode can be undone; copy mode writes into the plugin's output and leaves the originals alone.
- **Plan first**: organize-plan.csv lists each file, its date, the source and its destination.
- **Panel**: pick input files, adjust settings, see problems, edit any cell in the table, preview the result and export — all in the ZCode side panel. Edits are saved in `photo-date-organizer/<project>.project.json` and kept until you re-open the inputs.

## Usage

Ask the agent in ZCode Desktop:

- "Sort 手机相册/ into year/month folders by date taken"
- "Also rename them to the date, like 20261002_091500.jpg"
- "Undo the last move"

## Tools

| Tool | Purpose |
|---|---|
| `photos_open` | Read the date of every photo and video in a folder and plan the date folders. Opens the panel |
| `photos_edit` | Change settings, edit cells by row, add or remove rows |
| `photos_status` | Show the current rows, issues and summary |
| `photos_export` | Write organize-plan.csv, then move or copy the files into the date folders (organize-log.csv); undo moves them back |

Output goes to `photo-date-organizer/<project>/` in the workspace.

## Scope (v0.1)

- Dates are the camera's local time; time zones are not converted (videos use the computer's time zone).
- No face, place or content grouping; GPS is read but not used for folders in v0.1.
- One folder (with subfolders) and up to 20,000 files per project; RAW formats other than DNG fall back to the name or file time.

## Privacy, network and files

- **Everything runs locally.** No network, no uploads, no API keys or accounts.
- Reads only the files you choose. Writes only the `photo-date-organizer/` folder in the workspace; in move mode it also moves the photos inside the folder you pick, but only when you click “Organize” (and back with “Undo last move”). No hooks.

## Build and test (developers)

- Source: `ui-plugins/photo-date-organizer/`.
- Build: `pnpm install --frozen-lockfile && pnpm build`, then add `dist/local-marketplace` as a local source.
- Tests: `pnpm --filter @penova/plugin-photo-date-organizer test` and `test:e2e` (needs Chrome; sample files in `test/samples/`).

## Third-party components and licenses

MIT licensed (author: Penova). Bundled: MCP SDK and ext-apps (MIT), zod (MIT); the full list is in `dist/THIRD_PARTY_NOTICES.txt`.
52 changes: 52 additions & 0 deletions external_plugins/photo-date-organizer/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 照片按日期整理

把乱七八糟的手机照片、截图和视频,按拍摄日期整理进“年/月”文件夹——日期取自 EXIF、视频创建时间或文件名里的日期,最后才用文件修改时间——还可以统一改名成 20261002_091500.jpg。每个文件都标明日期来源,日期可以手动改正,移动后还能撤销。在本地运行,无需 API 密钥。

## 功能

- **优先用真实日期**:JPEG/HEIC/TIFF/DNG 的 EXIF 拍摄时间、MP4/MOV 的创建时间,其次是文件名里的日期(IMG_20261103_101522、Screenshot 2026-11-05 at 10.22.31、微信图片_20261106、mmexport 时间戳),最后才用文件修改时间——并会提醒,因为拷贝会改变它。
- **文件夹结构**:2026/2026-10、2026-10、2026/10、2026/2026-10-02、2026-10-02 或不分文件夹;保留原名、改成日期,或“日期 + 原名”。
- **表格里改正**:日期可以写成 2024-02-02 12:00 或 2024年2月2日 等格式,来源会变成“手动”。会显示相机品牌和型号。
- **安全**:重名自动加 -2、-3,不会覆盖任何文件。移动模式可以撤销;复制模式写到插件输出文件夹,原文件不动。
- **先看清单**:organize-plan.csv 列出每个文件的日期、来源和去向。
- **面板**:在 ZCode 侧栏里选择输入文件、调整设置、查看问题、直接修改表格里的任意单元格、预览成品并导出。修改保存在 `photo-date-organizer/<项目>.project.json`,重新打开输入文件前一直保留。

## 使用方法

在 ZCode 桌面端对助手说:

- “把 手机相册/ 按拍摄日期整理成 年/月 文件夹”
- “顺便把文件名改成日期,像 20261002_091500.jpg”
- “撤销刚才的整理”

## 工具

| 工具 | 作用 |
|---|---|
| `photos_open` | 读取文件夹里每张照片和每个视频的日期,规划日期文件夹,并打开面板 |
| `photos_edit` | 修改设置、按行修改单元格、新增或删除行 |
| `photos_status` | 查看当前数据、问题和汇总 |
| `photos_export` | 导出 organize-plan.csv,再把文件移动或复制到日期文件夹(organize-log.csv);undo 可移回原处 |

导出文件写到工作区的 `photo-date-organizer/<项目>/` 文件夹。

## 范围(v0.1)

- 日期按相机记录的本地时间,不做时区换算(视频按电脑所在时区)。
- 不按人脸、地点或内容分组;v0.1 会读取 GPS 但不用于分文件夹。
- 每个项目一个文件夹(可含子文件夹),最多 20,000 个文件;DNG 以外的 RAW 格式按文件名或文件时间。

## 隐私、网络与文件

- **全部在本地运行。** 不联网、不上传,不需要 API 密钥或账号。
- 只读取你选择的文件,只写入工作区的 `photo-date-organizer/` 文件夹;移动模式下,只有在你点“开始整理”时才会移动所选文件夹里的照片(点“撤销上次整理”可移回)。没有 Hook。

## 构建与测试(开发者)

- 源码:`ui-plugins/photo-date-organizer/`。
- 构建:`pnpm install --frozen-lockfile && pnpm build`,然后把 `dist/local-marketplace` 添加为本地来源。
- 测试:`pnpm --filter @penova/plugin-photo-date-organizer test` 和 `test:e2e`(需要 Chrome;样例文件在 `test/samples/`)。

## 第三方组件与许可证

MIT 许可(作者:Penova)。打包的组件:MCP SDK 与 ext-apps(MIT)、zod(MIT);完整列表见 `dist/THIRD_PARTY_NOTICES.txt`。
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: photo-date-organizer
description: 把乱七八糟的手机照片、截图和视频,按拍摄日期整理进“年/月”文件夹——日期取自 EXIF、视频创建时间或文件名里的日期,最后才用文件修改时间——还可以统一改名成 20261002_091500.jpg。每个文件都标明日期来源,日期可以手动改正,移动后还能撤销。在本地运行,无需 API 密钥。 用户提到“整理照片 / 按日期归档 / 拍摄时间 / 相册分文件夹 / 照片改名成日期”时使用。
---

# 照片按日期整理

1. `photos_open(inputs, settings?, project?)`:读取文件夹里每张照片和每个视频的日期,规划日期文件夹。inputs 是工作区相对路径。
- 结果里有汇总、问题列表(错误 / 提醒)和前几行数据,每行有编号 `#n`。
- inputs 传一个文件夹;settings 可设 folders(如 "yyyy/yyyy-MM")、naming(keep/date/date-name)、mode(move/copy)。
2. 向用户简要说明结果,先说错误和需要确认的地方,不要逐行念。
3. 用户要改时调用 `photos_edit(project, settings?, set?: [{row, values}], add?, remove?)`。
- 改日期:`set: [{row, values: {date: "2024-02-02 12:00"}}]`。
4. `photos_export(project, formats?)`:导出 organize-plan.csv,再把文件移动或复制到日期文件夹(organize-log.csv);undo 可移回原处。把文件路径告诉用户。
5. 来源是“文件修改时间”的要提醒用户核对。先导出 plan 给用户看,同意后再导出 organize。
49 changes: 49 additions & 0 deletions marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,55 @@
"把上一个 Hi3D 任务生成的模型按角色拆分成部件"
]
}
},
{
"name": "photo-date-organizer",
"componentTypes": [
"ui"
],
"source": "./external_plugins/photo-date-organizer",
"displayName": "Photo Date Organizer",
"displayName_i18n": {
"en": "Photo Date Organizer",
"zh-CN": "照片按日期整理"
},
"description": "Sort a messy folder of phone photos, screenshots and videos into year/month folders by the date they were taken — read from EXIF, the video's creation time or a date in the file name, with the file time only as a last resort — and optionally rename them to 20261002_091500.jpg. Every file shows where its date came from, you can correct any date, and a move can be undone. Runs locally; no API keys.",
"description_i18n": {
"en": "Sort a messy folder of phone photos, screenshots and videos into year/month folders by the date they were taken — read from EXIF, the video's creation time or a date in the file name, with the file time only as a last resort — and optionally rename them to 20261002_091500.jpg. Every file shows where its date came from, you can correct any date, and a move can be undone. Runs locally; no API keys.",
"zh-CN": "把乱七八糟的手机照片、截图和视频,按拍摄日期整理进“年/月”文件夹——日期取自 EXIF、视频创建时间或文件名里的日期,最后才用文件修改时间——还可以统一改名成 20261002_091500.jpg。每个文件都标明日期来源,日期可以手动改正,移动后还能撤销。在本地运行,无需 API 密钥。"
},
"version": "0.1.0",
"author": {
"name": "Penova",
"url": "https://github.com/ppppp2005-p"
},
"license": "MIT",
"category": "productivity",
"keywords": [
"photos",
"exif",
"date taken",
"organize",
"sort by date",
"screenshots",
"照片整理",
"按日期",
"拍摄时间",
"相册",
"归档"
],
"examplePrompts": [
"Sort 手机相册/ into year/month folders by date taken",
"Also rename them to the date, like 20261002_091500.jpg",
"Undo the last move"
],
"examplePrompts_i18n": {
"zh-CN": [
"把 手机相册/ 按拍摄日期整理成 年/月 文件夹",
"顺便把文件名改成日期,像 20261002_091500.jpg",
"撤销刚才的整理"
]
}
}
]
}
Loading