function ImgurDir {
if [ -d ~/imgur\ albums ]
then
cd ~/imgur\ albums
else
mkdir ~/imgur\ albums
cd ~/imgur\ albums
fi
}
function readAlbum {
echo "what album do you want?"
read album
}
function GetLinks {
wget -q www.imgur.com/a/$album
links=$(grep -o \<img\ id=\"thumb-..... $album)
rm $album
}
function subdir {
if [ -d $album ]
then
cd $album
rm -rf
else
mkdir $album
cd $album
fi
}
function GetImg {
COUNTER=0
printf %s "$links" | while IFS= read -r line
do
let COUNTER=COUNTER+1
shorter=${line:15}
wget -q www.i.imgur.com/$shorter.gif
echo "getting image" $COUNTER
done
}
function main {
ImgurDir
long=$USERNAME
short=${long:0:1}
echo "Welcome" "${short^^}""${long:1}" "to Denis' Imgur album downloading script!(currently only supports \"Blog Layout\")"
readAlbum
subdir
GetLinks
GetImg
}
main