#!/bin/bash
BASEDIR="$HOME/var/media/nyt"
DATE=$(date +"%Y-%m-%d")
TMPFILE=/tmp/nyt.pdf
OUTFILE=$BASEDIR/$DATE.jpg

if test -f "$OUTFILE"; then
	echo "NYT front page already found. Not downloading."
else
	DATEPATH=$(date +"%Y/%m/%d")
	curl -o /tmp/nyt.pdf -L https://static01.nyt.com/images/$DATEPATH/nytfrontpage/scan.pdf
	convert -density 150 -quality 100 $TMPFILE $OUTFILE
	rm $TMPFILE
fi

sxiv $OUTFILE &
