aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2020-05-07 23:40:35 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2020-05-07 23:40:35 +0200
commitf166f9d2afbc9bd39a58db806fcc659c787f7455 (patch)
tree39b965c815926d560a9cdffab8e394e3b7e62331
parent40c2cdb4912ced8c023a1b8b19527e2d151e1e01 (diff)
downloadscripts-f166f9d2afbc9bd39a58db806fcc659c787f7455.tar.gz
scripts-f166f9d2afbc9bd39a58db806fcc659c787f7455.zip
Fixed showURLimage.sh to detect and show thumbnails of youtube videos.
-rwxr-xr-xshowURLimage.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/showURLimage.sh b/showURLimage.sh
index 0650f0c..ee67593 100755
--- a/showURLimage.sh
+++ b/showURLimage.sh
@@ -3,11 +3,14 @@
# 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"
-echo "$url" | grep -i "youtube" >/dev/null &&
+if echo "$url" | grep -i "youtube" >/dev/null; then
url="$(youtube-dl --get-thumbnail "$url")"
+ folder="${folder}/$(date +%H%M%S)"
+fi
-folder="/tmp/showURLimage"
filename="${folder}/$(date +%H%M%S)"
[ -d "$folder" ] || mkdir -p "$folder"