mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-04-29 17:20:21 -05:00
- Updated generate_filename() to extract and use original filenames from URLs - Removes CDN hash suffixes (e.g., 'oranges-frogs_abc123' -> 'oranges-frogs') - Sanitizes filenames properly - Added redownload script to rename existing auto-* images - Added rename helper script for manual renaming if needed Examples: - oranges-frogs_nHEaTqne53.png -> oranges-frogs.png - img_class_Oafs1LJbVZ.jpg -> img_class.jpg - img_3_03NVYn1A61.png -> img_3.png
25 lines
788 B
Bash
Executable File
25 lines
788 B
Bash
Executable File
#!/bin/bash
|
|
# Re-download images with better filenames
|
|
|
|
echo "🔄 Re-downloading images with proper filenames"
|
|
echo "=============================================="
|
|
|
|
# Remove old auto-* images
|
|
echo "🗑️ Removing old auto-* images..."
|
|
find quarto/contents/labs -type f -name "auto-*" -delete
|
|
|
|
# Also remove the directories if they're empty
|
|
find quarto/contents/labs -type d -name "images" -empty -delete
|
|
find quarto/contents/labs -type d \( -name "png" -o -name "jpg" -o -name "jpeg" \) -empty -delete
|
|
|
|
echo "✅ Old images removed"
|
|
echo ""
|
|
|
|
# Re-download all images from labs
|
|
echo "📥 Re-downloading images with new naming..."
|
|
python3 tools/scripts/manage_external_images.py -d quarto/contents/labs/
|
|
|
|
echo ""
|
|
echo "✅ Done! Images have been re-downloaded with proper filenames"
|
|
|