Files
SirHumza--orbisRPC/scripts/sync_icons.sh
T
SirHumza 02d68410ac External-URL artwork pipeline + icon sync
- discord: large_image as <art_base_url><lower titleId>.png when
  configured (Discord accepts external URLs in asset fields);
  uploaded-asset keys remain as fallback via application_id
- cfg: art_base_url field with load/save support
- scripts/sync_icons.sh: FTP pulls all icon0.png (read-only)
- deploy/ARTWORK.md rewritten around URL-pack-first design
2026-09-19 10:24:20 +02:00

42 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# sync_icons.sh - pull /user/appmeta/<TITLEID>/icon0.png off the PS4 into
# config/icons/<lower titleid>.png, ready to host as the art pack.
# Usage: ./scripts/sync_icons.sh [PS4_IP] default: 192.168.1.136
# Nothing here touches the console beyond FTP reads.
set -euo pipefail
IP="${1:-192.168.1.136}"
OUT="config/icons"
mkdir -p "$OUT"
python3 - "$IP" "$OUT" <<'EOF'
import sys, os
from ftplib import FTP
ip, out = sys.argv[1], sys.argv[2]
f = FTP()
f.connect(ip, 2121, timeout=15)
f.login()
names = f.nlst('/user/appmeta')
got, miss = 0, []
for t in names:
if len(t) != 9:
continue
dst = os.path.join(out, t.lower() + '.png')
if os.path.exists(dst):
got += 1
continue
try:
with open(dst, 'wb') as fh:
f.retrbinary('RETR /user/appmeta/%s/icon0.png' % t, fh.write)
# validate PNG magic
with open(dst, 'rb') as fh:
if fh.read(8) != b'\x89PNG\r\n\x1a\n':
os.remove(dst)
miss.append(t)
continue
got += 1
except Exception:
miss.append(t)
try: os.remove(dst)
except OSError: pass
print('icons: %d ok, %d missing (%s)' % (got, len(miss), ','.join(miss[:10])))
EOF