#!/bin/bash #################################################### #Visit my blog: http://ubuntued.info/ # #################################################### name=$( zenity --entry --text="URL:" --title="Apple Trailers") temp=$(echo $name grep "/hd/") if [[ $temp = "" ]] then name=$(echo $name"hd/") fi quality=$(zenity --text="Which quality do you wish?" --list --radiolist --column sel --column sel2 1 480 2 720 3 1080) if [[ $name != "" ]] then wget $name -File.html case $quality in 480) action=$(cat file.html grep 480 awk -F"','" '{ print $10 }' awk -F"480" '{ print "wget " $1 "h480" $2 }') ;; 720) action=$(cat file.html grep 720 awk -F"','" '{ print $10 }' awk -F"720" '{ print "wget " $1 "h720" $2 }') ;; 1080) action=$(cat file.html grep 1080 awk -F"','" '{ print $10 }' awk -F"1080" '{ print "wget " $1 "h1080" $2 }') ;; esac rm file.html action=$(echo $action awk -F"/" '{ print $NF }') existent=$(ls grep "$action") if [[ $existent = $action ]] then zenity --question --text="You already have this trailer: \n \t (File name: $existent ).\n Do you wish to continue?" exit fi $action sh existent=$(ls grep "$action") if [[ $existent = $action ]] then zenity --info --text="Well-succeeded, the file was saved as $existent" else zenity --error --text="Fail ocurred. Possible problems: The file already existed or thedownload couldn't be done." fi fi