Improved interface
This commit is contained in:
parent
354bcbb8a2
commit
0e7c9f71e2
@ -1,9 +1,48 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
tag="scenic"
|
|
||||||
|
tags="scenic order:random width:1600"
|
||||||
picdir=`realpath $(dirname "${BASH_SOURCE[0]}")`
|
picdir=`realpath $(dirname "${BASH_SOURCE[0]}")`
|
||||||
|
del="30m"
|
||||||
|
sud=0
|
||||||
|
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
-s=*|--start-up-delay=*)
|
||||||
|
sud="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-d=*|--delay=*)
|
||||||
|
del="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-t=*|--tags=*)
|
||||||
|
tags="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-h|--help*)
|
||||||
|
echo "usage: $0 <options>"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -s --start-up-delay=del Set time between start and first image request."
|
||||||
|
echo " -d --delay=del Set delay between image requests."
|
||||||
|
echo " -t --tags=tags The actual search string. Special fields allowed."
|
||||||
|
echo "Notes:"
|
||||||
|
echo " All times need to be formatted for the sleep command."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Unknown
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$sud" != "0" ]; then
|
||||||
|
sleep "$sud";
|
||||||
|
fi
|
||||||
|
|
||||||
|
tags=`echo -n "$tags" | sed "s/ /%20/g"`
|
||||||
|
|
||||||
while [ 0 ]; do
|
while [ 0 ]; do
|
||||||
json=`curl "http://konachan.com/post.json?tags=$tag%20order:random%20width:1600&limit=1"`
|
json=`curl "http://konachan.com/post.json?tags=$tags&limit=1"`
|
||||||
|
|
||||||
id=`echo $json | jq -r '.[0].id'`
|
id=`echo $json | jq -r '.[0].id'`
|
||||||
url=`echo $json | jq -r '.[0].file_url'`
|
url=`echo $json | jq -r '.[0].file_url'`
|
||||||
@ -11,13 +50,14 @@ while [ 0 ]; do
|
|||||||
|
|
||||||
local_url="$picdir/$id.$ext"
|
local_url="$picdir/$id.$ext"
|
||||||
|
|
||||||
|
echo "Updating wallpaper to $id..."
|
||||||
if [ -f "$local_url" ]; then
|
if [ -f "$local_url" ]; then
|
||||||
echo "Already set as wallpaper. Waiting for new one..."
|
echo "Already downloaded."
|
||||||
else
|
else
|
||||||
echo "Updating wallpaper!"
|
echo "Downloading $url..."
|
||||||
curl -o "$local_url" "$url"
|
curl -o "$local_url" "$url"
|
||||||
fi
|
fi
|
||||||
gsettings set org.gnome.desktop.background picture-uri "$local_url"
|
gsettings set org.gnome.desktop.background picture-uri "$local_url"
|
||||||
|
|
||||||
sleep 1h
|
sleep "$del"
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user