[object Object]

← back to Japan Enrich

japan: append-9-to-live.sh — targeted idempotent append of the 9 new wallcoverings to live staging (no overwrite of the larger live set)

8812a8f3ef685f622e20a5519256e0973fda604c · 2026-07-06 18:13:43 -0700 · Steve

Files touched

Diff

commit 8812a8f3ef685f622e20a5519256e0973fda604c
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 6 18:13:43 2026 -0700

    japan: append-9-to-live.sh — targeted idempotent append of the 9 new wallcoverings to live staging (no overwrite of the larger live set)
---
 scripts/append-9-to-live.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/scripts/append-9-to-live.sh b/scripts/append-9-to-live.sh
new file mode 100755
index 0000000..8b65c9c
--- /dev/null
+++ b/scripts/append-9-to-live.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# Add ONLY the 9 new Sangetsu wallcovering patterns to the LIVE japan viewer's staging,
+# by APPEND (never overwrite — live has 18,272 colorways vs local 13,556). Idempotent:
+# skips any pattern whose source_url is already present. Merges brand entries additively.
+# Run under Steve:  bash ~/Projects/japan-enrich/scripts/append-9-to-live.sh
+set -euo pipefail
+cd "$(dirname "$0")/.."
+
+# 1) extract the 9 new records + their brand entries locally
+python3 - <<'PY'
+import json
+recs=[]; brands={}
+bm=json.load(open('staging/sangetsu-brands.json'))
+for l in open('staging/sangetsu-staging.jsonl'):
+    l=l.strip()
+    if not l: continue
+    r=json.loads(l)
+    if r.get('status')=='storeapi-new':
+        recs.append(l); u=r['source_url']
+        brands[u]=bm.get(u,{'distributor':r.get('distributor'),'slug':None})
+open('staging/sangetsu-new9.jsonl','w').write('\n'.join(recs)+('\n' if recs else ''))
+json.dump(brands,open('staging/sangetsu-brands-new9.json','w'),ensure_ascii=False)
+print(f'extracted {len(recs)} records + {len(brands)} brand entries')
+PY
+
+# 2) push the small patch files
+rsync -avz staging/sangetsu-new9.jsonl staging/sangetsu-brands-new9.json \
+  root@45.61.58.125:/root/Projects/japan-staging-viewer/staging/
+
+# 3) apply on the server: idempotent append + additive brand merge, then reload the viewer
+ssh root@45.61.58.125 bash -s <<'REMOTE'
+cd /root/Projects/japan-staging-viewer/staging
+python3 - <<'PY'
+import json
+def slug(u): return (u or '').rstrip('/').split('/')[-1].lower()
+have={slug(json.loads(l).get('source_url','')) for l in open('sangetsu-staging.jsonl') if l.strip()}
+added=0
+with open('sangetsu-staging.jsonl','a') as out:
+    for l in open('sangetsu-new9.jsonl'):
+        l=l.strip()
+        if not l: continue
+        r=json.loads(l)
+        if slug(r.get('source_url','')) not in have:
+            out.write(l+'\n'); added+=1
+bm=json.load(open('sangetsu-brands.json')); new=json.load(open('sangetsu-brands-new9.json'))
+for k,v in new.items(): bm.setdefault(k,v)
+json.dump(bm,open('sangetsu-brands.json','w'),ensure_ascii=False,indent=0)
+print(f'appended {added} new patterns to LIVE staging; brand map merged ({len(bm)} keys)')
+PY
+pm2 restart japan-viewer >/dev/null 2>&1 && echo "viewer restarted"
+REMOTE
+echo "done — verify: curl -su admin:DW2024! https://japan.designerwallcoverings.com/api/products | grep -c storeapi"

← c0773d3 japan: +9 new Sangetsu wallcoverings (198 colorways) the sit  ·  back to Japan Enrich  ·  japan: onboard 242 NEW wallcoverings from goodrichglobal Sin c7b77dd →