set the output directory to static due to cronnie problems

This commit is contained in:
2025-07-15 21:46:31 +02:00
parent 5fed9922fb
commit 84fad656ab

View File

@@ -4,6 +4,7 @@
# set -xv
EUMETSAT_KEY="jdBM1PsDQUm0tCZfk9VXD6IaJoUa"
EUMETSAT_SECRET="SumkiqFMU3MAGpt_azb1KXKgjdMa"
OUTDIR="$HOME/photos/eumetsat"
error() {
printf "\033[31m%s\033[0m\n" "$1"
@@ -13,15 +14,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" \
@@ -44,9 +36,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"