aboutsummaryrefslogtreecommitdiff
path: root/showURLimage.sh
blob: 0650f0cefab5acc1f55e0a189217ad6c0090f468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

# Downloads an url to /tmp and opens it with sxiv.
# If the url is from youtube tries to download the thumbnail.

url="$1"
echo "$url" | grep -i "youtube" >/dev/null &&
	url="$(youtube-dl --get-thumbnail "$url")"

folder="/tmp/showURLimage"
filename="${folder}/$(date +%H%M%S)"

[ -d "$folder" ] || mkdir -p "$folder"
curl "$url" > "$filename"
sxiv -b -N "sxivfloat" "$filename" || notify-send "No image found at $url"