make wkgen better
This commit is contained in:
parent
81df6aaa8f
commit
2693967c34
|
@ -1,13 +1,23 @@
|
|||
#!/bin/bash
|
||||
date='date +%Y-%m-%d\ %T'
|
||||
logfile=~/.wkgen.log
|
||||
filelocation=/home/plex/Pictures/wallpaper/wk-progress.1.png
|
||||
prepath="${XDG_PICTURES_DIR:=$HOME/Pictures}"
|
||||
mkdir -p "$prepath/wallpaper"
|
||||
filelocation="$prepath/wallpaper/wk-progress.1.png"
|
||||
set -e
|
||||
oldhash="$(sha256sum $filelocation || echo none)"
|
||||
echo "[$(eval $date)]: starting webrequests..." | tee -a $logfile
|
||||
curl -s -o $filelocation "https://wkgen.homeserver.box/?k=7b98a684-5c91-44ab-86b1-f7023609fe4e&d=1"
|
||||
curl -s -o $filelocation -A "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36" -o "wallpaper.png" "http://wkw.natural20design.com/?k=7b98a684-5c91-44ab-86b1-f7023609fe4e&d=1"
|
||||
newhash="$(sha256sum $filelocation)"
|
||||
echo -e "\tnew:\t$newhash\n\told:\t$oldhash"
|
||||
if [[ "$oldhash" = "$newhash" ]]; then
|
||||
echo "same files, nothing to do"
|
||||
exit
|
||||
else
|
||||
echo "[$(eval $date)]: setting wallpaper..." | tee -a $logfile
|
||||
kwriteconfig5 \
|
||||
--file "$HOME/.config/plasma-org.kde.plasma.desktop-appletsrc" \
|
||||
--group 'Containments' --group '1' --group 'Wallpaper' --group 'org.kde.image' \
|
||||
--group 'General' --key 'Image' $filelocation
|
||||
kwriteconfig5 --file \
|
||||
"$HOME/.config/plasma-org.kde.plasma.desktop-appletsrc" --group \
|
||||
'Containments' --group '1' --group 'Wallpaper' --group 'org.kde.image' \
|
||||
--group 'General' --key 'Image' "$filelocation"
|
||||
echo "[$(eval $date)]: done" | tee -a $logfile
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue