re-separate rename/organize, canonical --resort for AI folders

rename-ai-snaps is rename-only again (+--include-renamed, +--only-generic);
extract-ai-meta is the shared recursive metadata engine emitting canonical
model/lora dest paths; organize-images does all sorting, gains --resort for
idempotent tree re-sorts (used to fix ~10K old-scheme folders on the NAS).
This commit is contained in:
2026-07-30 21:04:37 -07:00
parent 1c1dbf7f21
commit 32859a5df0
6 changed files with 611 additions and 311 deletions

View File

@@ -3,6 +3,9 @@
# sync-comfyui-snaps — Pull new images from nimo.loc ComfyUI output, sync to NAS,
# then rename AI snaps and organize.
#
# NOTE: superseded by comfyui-sync (systemd user timer on nimo.loc). Kept for
# reference/manual use; the cron entry below is NOT currently installed.
#
# Crontab (every 2 hours):
# 0 */2 * * * /home/schmeeve/.local/bin/sync-comfyui-snaps >> /home/schmeeve/.local/log/sync-comfyui-snaps.log 2>&1
#
@@ -72,19 +75,26 @@ rsync -vu --checksum \
--progress --stats \
"${SRC}" "${DEST}/"
# 3. Rename AI snaps (non-interactive for automation)
AI_OUTPUT="${DEST}/Images/AI"
# 3. Route fresh drops into Images/ (neatcli equivalent), then rename in place.
# NOTE: rename-ai-snaps no longer takes --output; it only renames.
# organize-images does the model/lora sorting.
IMAGES_DIR="${DEST}/Images"
mkdir -p "${IMAGES_DIR}"
find "${DEST}" -maxdepth 1 -type f \
\( -iname '*.png' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.webp' \) \
-exec mv -n {} "${IMAGES_DIR}/" \;
if [ -x "${RENAME_SCRIPT}" ]; then
echo "[sync-comfyui-snaps] Running rename-ai-snaps on ${DEST} → ${AI_OUTPUT}"
"${RENAME_SCRIPT}" "${DEST}" --output "${AI_OUTPUT}" --no-interactive
echo "[sync-comfyui-snaps] Running rename-ai-snaps on ${IMAGES_DIR}"
"${RENAME_SCRIPT}" "${IMAGES_DIR}" --no-interactive
else
echo "[sync-comfyui-snaps] WARNING: rename-ai-snaps not found at ${RENAME_SCRIPT}"
fi
# 4. Organize images
# 4. Organize images into AI/{model}/{lora}/
if [ -x "${ORGANIZE_SCRIPT}" ]; then
echo "[sync-comfyui-snaps] Running organize-images on ${DEST}"
"${ORGANIZE_SCRIPT}" "${DEST}" -e
echo "[sync-comfyui-snaps] Running organize-images on ${IMAGES_DIR}"
"${ORGANIZE_SCRIPT}" "${IMAGES_DIR}" -e
else
echo "[sync-comfyui-snaps] WARNING: organize-images not found at ${ORGANIZE_SCRIPT}"
fi