aboutsummaryrefslogtreecommitdiff
path: root/showURLimage.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2020-03-25 13:52:00 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2020-03-30 17:29:07 +0200
commit1d5bd1d959189cf98700eaa8027d6e4dd01a164d (patch)
treec6cc394d1f78635e5e2876f589489f9cf49eff91 /showURLimage.sh
parentdf49022cbec4f9ed0d9f6e90b8ac22b1bb6a6c82 (diff)
downloadscripts-1d5bd1d959189cf98700eaa8027d6e4dd01a164d.tar.gz
scripts-1d5bd1d959189cf98700eaa8027d6e4dd01a164d.zip
Updated showURLImage.sh to get youtube thumbnails.
Diffstat (limited to 'showURLimage.sh')
-rwxr-xr-xshowURLimage.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/showURLimage.sh b/showURLimage.sh
index 2d5b485..cd7db1f 100755
--- a/showURLimage.sh
+++ b/showURLimage.sh
@@ -1,7 +1,14 @@
#!/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")"
filename="/tmp/showURLimage$(date +%H%M%S)"
-curl "$1" > "$filename"
-sxiv -b -N "sxivfloat" "$filename" || notify-send "No image found at $1"
+
+curl "$url" > "$filename"
+sxiv -b -N "sxivfloat" "$filename" || notify-send "No image found at $url"
+