aboutsummaryrefslogtreecommitdiff
path: root/showURLimage.sh
diff options
context:
space:
mode:
Diffstat (limited to 'showURLimage.sh')
-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"