#!/bin/bash
# Screenshot D7 (8080) and D10 (8081) for a list of paths.
# Usage: scripts/shots.sh <outdir> <width> <height> path1 path2 ...
OUT=$1; W=$2; H=$3; shift 3
C="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
mkdir -p "$OUT"
for p in "$@"; do
  n=$(echo "$p" | sed 's#^/##; s#[/?=&]#_#g'); [ -z "$n" ] && n=front
  "$C" --headless=new --disable-gpu --hide-scrollbars --window-size=$W,$H --screenshot="$OUT/${n}_d7_${W}.png" "http://localhost:8080$p" 2>/dev/null
  "$C" --headless=new --disable-gpu --hide-scrollbars --window-size=$W,$H --screenshot="$OUT/${n}_d10_${W}.png" "http://localhost:8081$p" 2>/dev/null
  echo "$n"
done
