← back to Japan Enrich

fetch_c_zips.sh

34 lines

#!/bin/bash
cd ~/Projects/japan-enrich
BASE_LIS2023="https://www.lilycolor.co.jp/interior/catalog/lis2023"
mkdir -p images/zips
# the 5 C (colorway) zips — Import_Selection already pulled as pilot_C.zip
declare -a CZIPS=(
 "Lilycolor_LIGHT_2025-28_C.zip"
 "Lilycolor_materials_2024_260213_C.zip"
 "Lilycolor_V-wall_2024-27_C.zip"
 "Lilycolor_will_2026-29_C.zip"
)
# discover each zip's real path from the manifest (paths differ per catalog)
python3 - > images/zips/_cmap.txt <<'PY'
import json,ast
seen={}
for l in open('staging/lilycolor-unified-staging.jsonl'):
    r=json.loads(l); man=r.get('image_manifest')
    if isinstance(man,str):
        try: man=ast.literal_eval(man)
        except: man=[]
    for m in (man or []):
        if isinstance(m,dict) and m.get('zipUrl','').endswith('_C.zip'):
            seen[m['zipUrl'].split('/')[-1]]=m['zipUrl']
for fn,u in sorted(seen.items()): print(u)
PY
while read -r u; do
  [ -z "$u" ] && continue
  fn="${u##*/}"
  [ "$fn" = "Lilycolor_Import_Selection_231018_C.zip" ] && continue
  echo "[fetch] $fn"
  curl -s -L --connect-timeout 20 -o "images/zips/$fn" "$u" && echo "[done] $fn $(ls -lh images/zips/$fn | awk '{print $5}')"
done < images/zips/_cmap.txt
echo "ALL C ZIPS FETCHED"