diff --git a/push-to-inky.sh b/push-to-inky.sh new file mode 100755 index 0000000..ba382a6 --- /dev/null +++ b/push-to-inky.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ $# -ne 1 ]]; then + echo "usage: $0 " >&2 + exit 1 +fi + +INPUT="$1" +NAME="$(basename "$INPUT")" +ROTATED="$(mktemp --suffix="-${NAME}")" +trap 'rm -f "$ROTATED"' EXIT + +.venv/bin/python3 - "$INPUT" "$ROTATED" <<'PY' +import sys +from PIL import Image +Image.open(sys.argv[1]).rotate(90, expand=True).save(sys.argv[2]) +PY + +rsync -v "$ROTATED" "inky-tasks:InkyImages/${NAME}" + +ssh inky-tasks "~/.virtualenvs/pimoroni/bin/python ~/inky/examples/spectra6/image.py --file ~/InkyImages/${NAME}" diff --git a/run-inky-today.sh b/run-inky-today.sh new file mode 100755 index 0000000..b4bcf31 --- /dev/null +++ b/run-inky-today.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")" + +PUSH=1 +if [[ "${1-}" == "--no-push" ]]; then + PUSH=0 + shift +fi + +OUT="${1:-inky_today.png}" + +./.venv/bin/python inky_today.py "$OUT" --no-push + +if (( PUSH )); then + ./push-to-inky.sh "$OUT" +fi