diff --git a/comfyui-sync b/comfyui-sync index b114f11..71cf1c0 100755 --- a/comfyui-sync +++ b/comfyui-sync @@ -4,20 +4,20 @@ set -euo pipefail SOURCE="$HOME/ComfyUI/output" SHARE_DIR="/mini.nas/miniShare1/Pictures" STATE_FILE="$HOME/.local/state/comfyui-sync.state" -NEATCLI="$(command -v neatcli || true)" +NEATCLI="$(command -v /home/linuxbrew/.linuxbrew/bin/neatcli || true)" RENAME_SCRIPT="$HOME/git/schmeeve-toolz/rename-ai-snaps" ORGANIZE_SCRIPT="$HOME/git/schmeeve-toolz/organize-images" mkdir -p "$(dirname "$STATE_FILE")" if [ ! -d "$SOURCE" ]; then - echo "[comfyui-sync] ERROR: Source $SOURCE does not exist" - exit 1 + echo "[comfyui-sync] ERROR: Source $SOURCE does not exist" + exit 1 fi if [ ! -d "$SHARE_DIR" ]; then - echo "[comfyui-sync] ERROR: Share dir $SHARE_DIR does not exist" - exit 1 + echo "[comfyui-sync] ERROR: Share dir $SHARE_DIR does not exist" + exit 1 fi echo "[comfyui-sync] Starting at $(date)" @@ -25,47 +25,47 @@ echo "[comfyui-sync] Starting at $(date)" current_files=$(find "$SOURCE" -maxdepth 1 -type f -printf '%f\n' | sort) if [ -f "$STATE_FILE" ]; then - new_files=$(comm -13 <(sort "$STATE_FILE") <(echo "$current_files")) + new_files=$(comm -13 <(sort "$STATE_FILE") <(echo "$current_files")) else - echo "[comfyui-sync] First run — all files considered new." - new_files="$current_files" + echo "[comfyui-sync] First run — all files considered new." + new_files="$current_files" fi new_count=$(echo "$new_files" | grep -c '[^[:space:]]' || true) if [ "$new_count" -gt 0 ]; then - echo "[comfyui-sync] Copying $new_count new file(s)..." - while IFS= read -r f; do - [ -z "$f" ] && continue - cp "$SOURCE/$f" "$SHARE_DIR/" - done <<< "$new_files" + echo "[comfyui-sync] Copying $new_count new file(s)..." + while IFS= read -r f; do + [ -z "$f" ] && continue + cp "$SOURCE/$f" "$SHARE_DIR/" + done <<<"$new_files" - echo "$current_files" > "$STATE_FILE" - echo "[comfyui-sync] State file updated." + echo "$current_files" >"$STATE_FILE" + echo "[comfyui-sync] State file updated." else - echo "[comfyui-sync] No new files to copy." + echo "[comfyui-sync] No new files to copy." fi if [ -n "$NEATCLI" ]; then - echo "[comfyui-sync] Running neatcli organize --by-type -e $SHARE_DIR" - "$NEATCLI" organize --by-type -e "$SHARE_DIR" + echo "[comfyui-sync] Running neatcli organize --by-type -e $SHARE_DIR" + "$NEATCLI" organize --by-type -e "$SHARE_DIR" else - echo "[comfyui-sync] WARNING: neatcli not found, skipping organize step" + echo "[comfyui-sync] WARNING: neatcli not found, skipping organize step" fi IMAGES_DIR="$SHARE_DIR/Images" if [ -d "$IMAGES_DIR" ] && [ -x "$RENAME_SCRIPT" ]; then - echo "[comfyui-sync] Running rename-ai-snaps on $IMAGES_DIR" - cd "$IMAGES_DIR" && "$RENAME_SCRIPT" . --no-interactive + echo "[comfyui-sync] Running rename-ai-snaps on $IMAGES_DIR" + cd "$IMAGES_DIR" && "$RENAME_SCRIPT" . --no-interactive elif [ ! -x "$RENAME_SCRIPT" ]; then - echo "[comfyui-sync] WARNING: rename-ai-snaps not found, skipping rename step" + echo "[comfyui-sync] WARNING: rename-ai-snaps not found, skipping rename step" fi if [ -d "$IMAGES_DIR" ] && [ -x "$ORGANIZE_SCRIPT" ]; then - echo "[comfyui-sync] Running organize-images on $IMAGES_DIR" - "$ORGANIZE_SCRIPT" "$IMAGES_DIR" --execute + echo "[comfyui-sync] Running organize-images on $IMAGES_DIR" + "$ORGANIZE_SCRIPT" "$IMAGES_DIR" --execute elif [ ! -x "$ORGANIZE_SCRIPT" ]; then - echo "[comfyui-sync] WARNING: organize-images not found, skipping organize step" + echo "[comfyui-sync] WARNING: organize-images not found, skipping organize step" fi echo "[comfyui-sync] Done at $(date)"