LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quick grab Scott's albums
#1
This will download Scott(0)'s albums from imgur.com
If you want to see the images click here.

Instructions.
Save the script anywhere, make executable, run (double click or via Terminal ./scott.sh).

Code:
#! /bin/bash

save_path(){
SAVE=$(zenity --file-selection --directory --title="Where do you want to save the images?")
    if [ "${PIPESTATUS[0]}" -ne "0" ]; then
        exit 0
    fi
#Create and then enter directory
cd "$SAVE"
mkdir "$NAME"
cd "$NAME"
}

get_list(){

LIST=$(mktemp /tmp/image_list.XXXXXX)

    for i in $(curl $URL | grep '{"hash":"' | sed 's/,/ /g;s/}[ ]{/\n/g;s/}].*$//g;s/.*\[{//g;s/"hash":"/i\.imgur.com\//g' | sed 's/"[ ]".*ext":"//g;s/".*$//g')
        do
            echo $i>> $LIST
        done
}

download(){
i=1
TOTAL_LINES=$(wc -l <$LIST)

for line in `cat $LIST`
    do
        wget -q $line 2>/dev/null       
        (( PERCENTAGE = 100 \* ${i} / ${TOTAL_LINES} ))
        echo "$PERCENTAGE"
        echo "#$PERCENTAGE% Downloaded"
        let ++i
        if [[ "$i" -gt  "$TOTAL_LINES" ]]; then
            break
        fi
    done | zenity --progress --auto-close --title="Downloading..."
   
unset URL
unset i
}

main_window(){
URL=$(zenity --list --radiolist --ok-label="Select" --cancel-label="Exit" --title="Quick Grab Scott's images" \
--text="Select Scott's albums you whish to download.\nThen, select the location you whish to save the images.\nAlbum's directory will we automatically ceated.\nhttp://scott53.imgur.com/" --height=490 --width=390 --hide-column=4 --print-column=4 \
--column="Pick" --column="Name" --column="Total images" --column="url" \
"TRUE" "Chalet OS 14.04" "50" "http://imgur.com/a/sp8Lu" \
"FALSE" "Elementary OS - Luna" "21" "http://imgur.com/a/8BZYD" \
"FALSE" "Linux Lite 2.2" "17" "http://imgur.com/a/mPNBt" \
"FALSE" "Linux Lite 2.0" "13" "http://imgur.com/a/bKmTP" \
"FALSE" "Linux Lite 1.0.8" "11" "http://imgur.com/a/U60p3" \
"FALSE" "Linux Lite 1.0.6" "19" "http://imgur.com/a/ZTnG4" \
"FALSE" "Linux Mint 17 Qiana XFCE" "24" "http://imgur.com/a/39E1J" \
"FALSE" "LXLE 14.04" "100" "http://imgur.com/a/EyYpO" \
"FALSE" "LXLE 12.04.4" "98" "http://imgur.com/a/hPT7V" \
"FALSE" "Makulu Cinnamon Debian Edition 1.0" "45" "http://imgur.com/a/86cL2" \
"FALSE" "Makulu 5.0 - XFCE" "79" "http://imgur.com/a/SuPAb" \
"FALSE" "Ubuntu Mate 14.10" "37" "http://imgur.com/a/ZXfzb" \
"FALSE" "Voyager 14.04.2" "176" "http://imgur.com/a/E6EiL" \
"FALSE" "Zorin 9 - Core" "18" "http://imgur.com/a/MD0If" \
)
    if [ "${PIPESTATUS[0]}" -ne "0" ]; then
        exit 0
    fi

case $URL in
"http://imgur.com/a/sp8Lu")
NAME="Chalet OS 14.04"
;;
"http://imgur.com/a/8BZYD")
NAME="Elementary OS - Luna"
;;
"http://imgur.com/a/mPNBt")
NAME="Linux Lite 2.2"
;;
"http://imgur.com/a/bKmTP")
NAME="Linux Lite 2.0"
;;
"http://imgur.com/a/U60p3")
NAME="Linux Lite 1.0.8"
;;
"http://imgur.com/a/ZTnG4")
NAME="Linux Lite 1.0.6"
;;
"http://imgur.com/a/39E1J")
NAME="Linux Mint 17 Qiana XFCE"
;;
"http://imgur.com/a/EyYpO")
NAME="LXLE 14.04"
;;
"http://imgur.com/a/hPT7V")
NAME="LXLE 12.04.4"
;;
"http://imgur.com/a/86cL2")
NAME="Makulu Cinnamon Debian Edition 1.0"
;;
"http://imgur.com/a/SuPAb")
NAME="Makulu 5.0 - XFCE"
;;
"http://imgur.com/a/ZXfzb")
NAME="Ubuntu Mate 14.10"
;;
"http://imgur.com/a/E6EiL")
NAME="Voyager 14.04.2"
;;
"http://imgur.com/a/MD0If")
NAME="Zorin 9 - Core"
;;
esac
}

main_window
save_path
get_list
unset URL
download
rm $LIST
thunar "$SAVE" &
exit 0
Reply
#2
Wow , you always get some new way of doing these bashes ! Props to you Misko .
HP DV7 i7 2670QM 500.1GB 8GB Ram Dual-Boot LL2.4 Beta / Extix 15.1.1 64-bit 
Dell Inspiron 1720 CrunchBang 11

Duckduckgo ( for now )
Reply
#3
Very nice, Misko, thanks!
[Image: q7j1yAl.png]
Reply
#4
Thanks. There are some nice wallpapers in ubuntu's repo.
Code:
apt-cache search '^.*-wallpapers|^.*-backgrounds'
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)