#!/bin/bash #################################################### #Visite o meu blog: http://ubuntued.blogspot.com/ # #################################################### nome=$( zenity --entry --text="URL:" --title="Apple Trailers") temp=$(echo $nome | grep "/hd/") if [[ $temp = "" ]] then nome=$(echo $nome"hd/") fi qualidade=$(zenity --text="Qual a qualidade desejada?" --list --radiolist --column sel --column sel2 1 480 2 720 3 1080) if [[ $nome != "" ]] then wget $nome -O ficheiro.html case $qualidade in 480) accao=$(cat ficheiro.html | grep 480 | awk -F"','" '{ print $10 }'| awk -F"480" '{ print "wget " $1 "h480" $2 }') ;; 720) accao=$(cat ficheiro.html | grep 720 | awk -F"','" '{ print $10 }'| awk -F"720" '{ print "wget " $1 "h720" $2 }') ;; 1080) accao=$(cat ficheiro.html | grep 1080 | awk -F"','" '{ print $10 }'| awk -F"1080" '{ print "wget " $1 "h1080" $2 }') ;; esac rm ficheiro.html accao=$(echo $accao | awk -F"/" '{ print $NF }') existe=$(ls | grep "$accao") if [[ $existe = $accao ]] then zenity --question --text="Você já tem este trailer: \n \t (Nome do ficheiro: $existe ).\n Continuar na mesma?" || exit fi $accao | sh existe=$(ls | grep "$accao") if [[ $existe = $accao ]] then zenity --info --text="Sucesso, o ficheiro foi guardado com o nome $existe" else zenity --error --text="Ocorreu algum erro. Possiveis problemas: Já tinha este ficheiro ou não foi possivel fazer download." fi fi