← back to Japan Enrich
japan: get-all-live.sh — push all new patterns (Thailand-uncategorized + Singapore) to live by idempotent append + brand merge (no overwrite)
52c7000ec8f88b1cc2e5178ddb89fd9a7a8dceea · 2026-07-06 18:49:09 -0700 · Steve
Files touched
A scripts/get-all-live.sh
Diff
commit 52c7000ec8f88b1cc2e5178ddb89fd9a7a8dceea
Author: Steve <steve@designerwallcoverings.com>
Date: Mon Jul 6 18:49:09 2026 -0700
japan: get-all-live.sh — push all new patterns (Thailand-uncategorized + Singapore) to live by idempotent append + brand merge (no overwrite)
---
scripts/get-all-live.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/scripts/get-all-live.sh b/scripts/get-all-live.sh
new file mode 100755
index 0000000..d84d41d
--- /dev/null
+++ b/scripts/get-all-live.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+# Push ALL new Sangetsu patterns (Thailand-uncategorized 'storeapi-new' + Singapore 'gg-sg-new')
+# to the LIVE japan viewer by APPEND — never overwrites (live has more colorways for the original
+# 623). Idempotent (skips source_urls already live). Merges the brand map additively so the new
+# patterns' distributors land. Run under Steve AFTER the Singapore brand scrape finishes.
+# bash ~/Projects/japan-enrich/scripts/get-all-live.sh
+set -euo pipefail
+cd "$(dirname "$0")/.."
+
+# 1) extract the new patterns + their brand entries locally
+python3 - <<'PY'
+import json
+bm=json.load(open('staging/sangetsu-brands.json'))
+recs=[]; brands={}
+for l in open('staging/sangetsu-staging.jsonl'):
+ l=l.strip()
+ if not l: continue
+ r=json.loads(l)
+ if r.get('status') in ('storeapi-new','gg-sg-new'):
+ recs.append(json.dumps(r,ensure_ascii=False)); u=r['source_url']
+ brands[u]=bm.get(u,{'distributor':r.get('distributor'),'slug':None})
+open('staging/sangetsu-newpatterns.jsonl','w').write('\n'.join(recs)+('\n' if recs else ''))
+json.dump(brands,open('staging/sangetsu-brands-new.json','w'),ensure_ascii=False)
+blank=sum(1 for u,v in brands.items() if not v.get('distributor'))
+print(f'{len(recs)} new patterns, {len(brands)} brand entries ({blank} still blank)')
+PY
+
+# 2) push the small patch files
+rsync -avz staging/sangetsu-newpatterns.jsonl staging/sangetsu-brands-new.json \
+ root@45.61.58.125:/root/Projects/japan-staging-viewer/staging/
+
+# 3) idempotent append + additive brand merge on the server, then reload
+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-newpatterns.jsonl'):
+ l=l.strip()
+ if not l: continue
+ r=json.loads(l); s=slug(r.get('source_url',''))
+ if s not in have: out.write(l+'\n'); have.add(s); added+=1
+bm=json.load(open('sangetsu-brands.json')); new=json.load(open('sangetsu-brands-new.json'))
+bm.update(new)
+json.dump(bm,open('sangetsu-brands.json','w'),ensure_ascii=False,indent=0)
+print(f'appended {added} new patterns to LIVE staging; brand map now {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 | python3 -c 'import sys,json;print(json.load(sys.stdin)[\"total\"])'"
← d0a51a9 japan: scrape_gg_sg_brands.py — resolve the 242 Singapore di
·
back to Japan Enrich
·
japan: nginx-final-fix.sh (IP-specific listen 45.61.58.125:8 0f8c526 →