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

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

folder="/tmp/showURLimage"

url="$1"
if echo "$url" | grep -i "youtube" >/dev/null; then
	url="$(youtube-dl --get-thumbnail "$url")"
	folder="${folder}/$(date +%H%M%S)"
fi

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"