Initial commit

This commit is contained in:
2026-08-20 16:48:16 +02:00
commit a5e5f7f9a9
54 changed files with 351 additions and 0 deletions
Executable
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env sh
PHOTOS_DIR="photos"
OUTPUT_FILE="photos.json"
# Check photos directory exists
if [ ! -d "$PHOTOS_DIR" ]; then
echo "Error: '$PHOTOS_DIR' directory not found."
exit 1
fi
# Start JSON array
printf "[\n" > "$OUTPUT_FILE"
# Collect JPG files (case-insensitive), sorted
# Works on macOS + Linux
FILES=$(ls -1 "$PHOTOS_DIR" 2>/dev/null | grep -i '\.jpg$' | sort)
COUNT=0
TOTAL=$(printf "%s\n" "$FILES" | grep -c .)
printf "%s\n" "$FILES" | while IFS= read -r FILE; do
COUNT=$((COUNT + 1))
if [ "$COUNT" -lt "$TOTAL" ]; then
printf " \"%s\",\n" "$FILE" >> "$OUTPUT_FILE"
else
printf " \"%s\"\n" "$FILE" >> "$OUTPUT_FILE"
fi
done
# End JSON array
printf "]\n" >> "$OUTPUT_FILE"
echo "Generated $OUTPUT_FILE with $TOTAL image(s)."