-
Notifications
You must be signed in to change notification settings - Fork 1
/
imgurView.sh
executable file
·37 lines (29 loc) · 881 Bytes
/
imgurView.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Author: Anton Krug
# Date: 2019/09/15
# Depending on: http://kmkeen.com/jshon/ for JSON parsing
# Your favorite image viewer, if no env variable given, use this:
imageViewer=${imageViewer:-comix}
# Detect the absolute location of this script
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ $# -eq 0 ]
then
echo "No arguments supplied. Usage:"
echo "imgurView. URLtoView [moreURLsToView] [moreURLsToView]"
echo ""
echo "Environment variable can change what viewer is used,"
echo "by default"
exit 1
fi
# Create the temporary directory
DIR=`mktemp -d`
cd $DIR
for i in $@
do
echo "Downloading gallery $i"
$CURRENT_DIR/imgurDownloader.sh $DIR $i
done
# After all galleries are downloaded display them in your favorite image viewer
$imageViewer $DIR
# Remove the temporary directory
rm -rf $DIR/