set the output directory to static due to cronnie problems

This commit is contained in:
2025-07-15 21:46:31 +02:00
parent b001d9ef83
commit 0767e30fab

View File

@@ -3,6 +3,8 @@
# set -xv
OUTDIR="$HOME/photos/eumetsat"
error() {
printf "\033[31m%s\033[0m\n" "$1"
exit 1
@@ -14,15 +16,6 @@ error() {
# verify internet
ping -c1 1.1.1.1 >>/dev/null || error "couldn't establish an internet connection!"
# acquire the output directory
if command -v xdg-user-dir; then
outdir="$(xdg-user-dir PICTURES)/eumetsat"
elif [ -z "$HOME" ]; then
outdir="$HOME/.eumetsat"
else
error "couldn't connect to either 'xdg-user-dir PICTURES' or '\$HOME'"
fi
# acquire the API key
key=$(
curl -k -d "grant_type=client_credentials" \
@@ -45,9 +38,9 @@ url+="&format=image/png"
url+="&access_token=$key"
# process incoming data
[ ! -d "$outdir" ] && { mkdir -p "$outdir" || error "failed to access '$outdir'!"; }
curl "$url" -o "$outdir/tmp.png" || error "failed to download from url='$url'!"
mv -f "$outdir/tmp.png" "$outdir/curr.png"
[ ! -d "$OUTDIR" ] && { mkdir -p "$OUTDIR" || error "failed to access '$OUTDIR'!"; }
curl "$url" -o "$OUTDIR/tmp.png" || error "failed to download from url='$url'!"
mv -f "$OUTDIR/tmp.png" "$OUTDIR/curr.png"
# update the feh background
. "$HOME/.fehbg"