merge: feature/recipe-images into main
Add image metadata to all 78 .cook recipe files: - Download and relink 19 existing images to roux.roo.lol - Find and download images for 50 recipes with frontmatter - Add frontmatter and images for 9 recipes without frontmatter - All images converted to proper WebP format
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
**Goal:** Give every `.cook` recipe file an `image:` field in YAML frontmatter pointing to `https://roux.roo.lol/recipe-images/<slug>.webp`, and download each image locally.
|
||||
|
||||
**Architecture:** Three parallel batches — (1) relink the 19 existing images, (2) discover + download + link 48 missing images (recipes with frontmatter), (3) create frontmatter + discover + link 9 more (recipes without frontmatter). Use subagent parallel dispatch for image discovery to keep wall-clock time manageable.
|
||||
**Architecture:** Three parallel batches — (1) relink the 19 existing images, (2) discover + download + link 50 missing images (recipes with frontmatter), (3) create frontmatter + discover + link 9 more (recipes without frontmatter). Use subagent parallel dispatch for image discovery to keep wall-clock time manageable.
|
||||
|
||||
**Tech Stack:** bash, curl, ImageMagick (convert), subagent researcher for web image search
|
||||
|
||||
@@ -13,50 +13,56 @@
|
||||
### Task 0: Setup — slug map, image dir, helper script
|
||||
|
||||
**Files:**
|
||||
- Create: `/home/jbrechtel/recipes/docs/slugs.csv`
|
||||
- Modify: none yet
|
||||
- Create: `docs/slugs.csv`
|
||||
- Create: `docs/has-image.csv`
|
||||
- Create: `docs/no-image-has-fm.csv`
|
||||
- Create: `docs/no-fm.csv`
|
||||
|
||||
- [ ] **Step 1: Generate slug mapping**
|
||||
|
||||
Run a one-liner that prints every `.cook` file with its slugified stem:
|
||||
Run a one-liner that prints every `.cook` file with its slugified stem, then deduplicate any collisions:
|
||||
|
||||
```bash
|
||||
cd /home/jbrechtel/recipes
|
||||
cd /home/jbrechtel/recipes/.worktrees/recipe-images
|
||||
for f in *.cook; do
|
||||
stem="${f%.cook}"
|
||||
slug=$(echo "$stem" \
|
||||
| tr '[:upper:]' '[:lower:]' \
|
||||
| sed -e 's/[^a-z0-9]/-/g' -e 's/--*/-/g' -e 's/^-//' -e 's/-$//')
|
||||
echo "$f|$slug"
|
||||
done > docs/slugs.csv
|
||||
head docs/slugs.csv
|
||||
done | awk -F'|' '
|
||||
{
|
||||
slug=$2
|
||||
count[slug]++
|
||||
if (count[slug] > 1) {
|
||||
slug = slug "-" count[slug]
|
||||
}
|
||||
print $1 "|" slug
|
||||
}' > docs/slugs.csv
|
||||
```
|
||||
|
||||
Expected: a pipe-delimited CSV like `Alain-Ducase-Bread.cook|alain-ducase-bread`.
|
||||
Total: 78 unique slugs (6 duplicate pairs get `-2` suffix).
|
||||
|
||||
- [ ] **Step 2: Create image directory**
|
||||
|
||||
```bash
|
||||
mkdir -p /home/jbrechtel/recipes/recipe-images
|
||||
mkdir -p recipe-images
|
||||
```
|
||||
|
||||
- [ ] **Step 3: Classify each recipe**
|
||||
|
||||
```bash
|
||||
cd /home/jbrechtel/recipes
|
||||
echo "=== Already has image ==="
|
||||
cd /home/jbrechtel/recipes/.worktrees/recipe-images
|
||||
while IFS='|' read -r f slug; do
|
||||
if grep -q "^image:" "$f" 2>/dev/null; then echo "$f|$slug"; fi
|
||||
done < docs/slugs.csv > docs/has-image.csv
|
||||
|
||||
echo "=== Has frontmatter, no image ==="
|
||||
while IFS='|' read -r f slug; do
|
||||
if head -1 "$f" 2>/dev/null | grep -q "^---"; then
|
||||
if ! grep -q "^image:" "$f" 2>/dev/null; then echo "$f|$slug"; fi
|
||||
fi
|
||||
done < docs/slugs.csv > docs/no-image-has-fm.csv
|
||||
|
||||
echo "=== No frontmatter ==="
|
||||
while IFS='|' read -r f slug; do
|
||||
if ! head -1 "$f" 2>/dev/null | grep -q "^---"; then echo "$f|$slug"; fi
|
||||
done < docs/slugs.csv > docs/no-fm.csv
|
||||
@@ -64,12 +70,11 @@ done < docs/slugs.csv > docs/no-fm.csv
|
||||
wc -l docs/has-image.csv docs/no-image-has-fm.csv docs/no-fm.csv
|
||||
```
|
||||
|
||||
Expected: 19 / 48 / 9 lines respectively.
|
||||
Expected: 19 / 50 / 9 = 78 total.
|
||||
|
||||
- [ ] **Step 4: Commit setup**
|
||||
|
||||
```bash
|
||||
cd /home/jbrechtel/recipes
|
||||
git add docs/slugs.csv docs/has-image.csv docs/no-image-has-fm.csv docs/no-fm.csv
|
||||
git commit -m "chore: add recipe slug mapping and classification CSVs"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user