diff options
Diffstat (limited to 'src/brweather')
-rwxr-xr-x | src/brweather | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/brweather b/src/brweather index 909b6de..7c59e51 100755 --- a/src/brweather +++ b/src/brweather @@ -100,12 +100,14 @@ Se o erro persistir por vários dias, entre em contato com o desenvolvedor pelo leandronkz@gmail.com" -##Ler arquivo de configuração -source ~/.brweather.conf ##Versão do programa VERSION=`cat $DIRNAME/doc/version` + +##Ler arquivo de configuração +source ~/.brweather.conf + ##Opções do programa que não precisam de Internet case $1 in "--gerar-log") source $DIRNAME/bin/logs @@ -114,7 +116,7 @@ case $1 in "--version") echo "BrWeather-$VERSION" exit 0 ;; - "--autor") echo "LeandroNKZ <leandronkz@gmail.com>" + "--autor") echo "Leandro Nkz <leandronkz@gmail.com>" echo "http://brweatherproject.blogspot.com/" exit 0 ;; @@ -195,7 +197,8 @@ elif [ $OPEN = "2" ] ; then TIME2=$(($TIME+$TIMER)) fi - +#API Key +KEY="ee701e50c956bc75c87e5b237b16fd64" if [ $TIME1 -lt $TIME ] ; then if [ $OPEN = "0" ] ; then @@ -203,20 +206,20 @@ if [ $TIME1 -lt $TIME ] ; then echo $TIME2 > ~/.brweather/cache/timer cat ~/.brweather/cache/previsao | iconv -f iso-8859-1 -t $CODIGO -o ~/.brweather/cache/previsao elif [ $OPEN = "1" ] ; then - wget -q -T $TIME -O ~/.brweather/cache/open1_A "http://openweathermap.org/data/2.1/weather/city/$OPEN_ID" - wget -q -T $TIME -O ~/.brweather/cache/open2_A "http://openweathermap.org/data/2.1/forecast/city/$OPEN_ID" + wget -q -T $TIME -O ~/.brweather/cache/open1_A "http://api.openweathermap.org/data/2.5/weather?id=$OPEN_ID&units=metric&APPID=$KEY" + wget -q -T $TIME -O ~/.brweather/cache/open2_A "http://api.openweathermap.org/data/2.5/forecast/daily?id=$OPEN_ID&units=metric&APPID=$KEY" echo $TIME2 > ~/.brweather/cache/timer2 elif [ $OPEN = "2" ] ; then wget -q -T $TIME -O ~/.brweather/cache/previsao "http://tempo1.cptec.inpe.br/cidades/tempo/$CPTEC_INPE" cat ~/.brweather/cache/previsao | iconv -f iso-8859-1 -t $CODIGO -o ~/.brweather/cache/previsao - wget -q -T $TIME -O ~/.brweather/cache/open1_A "http://openweathermap.org/data/2.1/weather/city/$OPEN_ID" - wget -q -T $TIME -O ~/.brweather/cache/open2_A "http://openweathermap.org/data/2.1/forecast/city/$OPEN_ID" + wget -q -T $TIME -O ~/.brweather/cache/open1_A "http://api.openweathermap.org/data/2.5/weather?id=$OPEN_ID&units=metric&APPID=$KEY" + wget -q -T $TIME -O ~/.brweather/cache/open2_A "http://api.openweathermap.org/data/2.5/forecast/daily?id=$OPEN_ID&units=metric&APPID=$KEY" echo $TIME2 > ~/.brweather/cache/timer3 fi if [ $OPEN = "0" ] ; then - if [ -f `grep -m1 -A1 '<div id="subcid">' ~/.brweather/cache/previsao | cut -f2 -d'>' | cut -f1 -d'<' | tail -n1 | sed 's/ /_/g'` ] ; then + if [ -f `grep '<div class="i">' ~/.brweather/cache/previsao | cut -f2 -d'>' | cut -f1 -d'<' | sed 's/ /_/g'` ] ; then echo "$ERROA1" > ~/.brweather/log echo $(($TIME+30)) > ~/.brweather/cache/timer else @@ -244,7 +247,7 @@ if [ $TIME1 -lt $TIME ] ; then done fi elif [ $OPEN = "2" ] ; then - if [ -f `grep -m1 -A1 '<div id="subcid">' ~/.brweather/cache/previsao | cut -f2 -d'>' | cut -f1 -d'<' | tail -n1 | sed 's/ /_/g'` ] ; then + if [ -f `grep '<div class="i">' ~/.brweather/cache/previsao | cut -f2 -d'>' | cut -f1 -d'<' | sed 's/ /_/g'` ] ; then echo "$ERROA1" > ~/.brweather/log echo $(($TIME+30)) > ~/.brweather/cache/timer3 else |