Output naming: --prefix/--suffix and safe default names beside the source

未关闭
#31 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
50/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
cli

调研方向

Read the implementations of resize and convert, along with the output naming behavior described in related issues #21 and #25. Decide how --prefix/--suffix, size suffixes beside the source, and --force should interact; the issue also raises a template flag as an alternative. Done means the chosen naming behavior is consistent and existing files are protected from overwrite unless --force is supplied.

由索引模型根据 Issue 内容生成。

描述

Problem

resize (single size) and convert keep the input's basename, so the output folder is the only thing keeping a derivative apart from its source. That is the root cause of #25: point --output at the source folder and the original is overwritten.

It also means batch scripts must rename each output afterward when they want web-ready names.

Options

  1. --prefix / --suffix: e.g. --suffix -web gives photo-web.jpg. Simple, predictable, and the user picks a name that makes sense in a URL.
  2. Default size suffix when writing beside the source. Multi-size resize already names files photo-300.jpg (#21). Using the same -{size} suffix whenever the output dir resolves to the input's dir would make #25 impossible by default.
  3. Datestamp (e.g. photo-20261117-1530.jpg): guarantees uniqueness, but the names are not deterministic, re-runs pile up copies, and the stamp ends up in public image URLs (Squarespace uses the filename as the URL).

Recommendation

Do 1 and 2. Treat a datestamp as an opt-in pattern, not the default. Pair it with a hard refusal to overwrite any existing file unless --force is given, which closes #25 even if naming is misconfigured.

A small --name template ({stem}, {w}, {h}, {date}) would cover all three options with one flag, if that is not over-engineering.

Context

Related: #25 (overwrite), #21 (output naming). Hit on 2026-11-17 with ipro 1.7.0 while renaming 24 exports by hand.

— Emily

主要语言
Python
星标
1
派生
0
平均合并
4 小时 13 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cadentdev/ipro 的其他 Issue

查看 cadentdev/ipro 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。