You are not logged in.

#51 2011-04-27 17:06:12

webmasteryoda
Member
From: Serbia
Registered: 2010-03-20
Posts: 115
Website

Re: Conky - Really Simple Weather Script

I did.
It stopped working... sad

Offline

#52 2011-05-06 16:15:30

Superewza
Member
Registered: 2011-04-25
Posts: 18

Re: Conky - Really Simple Weather Script

Right, just tried this, and it's slightly better than the previous weather solution i tried in that it displays nothing as opposed to something like "$WEATHER".

${font Helvetica:size=12}${color FFFFFF}${alignr}${execi 300 /home/buttons/bin/weather.sh EUR|UK|UK81|Newcastle} °C${font}

Any ideas?Thanks smile

Offline

#53 2011-07-30 23:09:01

retrodanny
Member
From: Mexico
Registered: 2011-07-30
Posts: 2

Re: Conky - Really Simple Weather Script

Hello,
I just spent a good 15 minutes struggling to find my city code (Tijuana Mexico - "NAM|MX|MX002|TIJUANA")
Wanted to show how to get the code if you are going through the same.
just google

site:http://www.accuweather.com/world-forecast-calendar.asp YOURCITY 

and the URL of one of the first results will give you the code
examples: EUR|FR|FR012|PARIS, EUR|UK|UK241|LONDON, NAM|MX|MX014|GUADALAJARA.. and so on
good luck smile

Last edited by retrodanny (2011-07-30 23:30:23)

Offline

#54 2011-10-22 01:43:32

rwp0921
Member
Registered: 2011-10-22
Posts: 1

Re: Conky - Really Simple Weather Script

@retrodanny: Thanks but your method failed for me, but led me to the partner..netweather. Then I found their link which worked for me. You need to fill out the form for your location, it will generate an html snippet for a web page (no signup req'd). The location code is in the html snippet ASI|TW|TW018|HSINCHU in my case :-)

http://netweather.accuweather.com/adcbi … -page2.asp

Offline

#55 2011-11-26 04:08:41

xdunlapx
Member
From: Ohio, USA
Registered: 2011-05-12
Posts: 19

Re: Conky - Really Simple Weather Script

I am using crunchbang right now and conky won't show weather information using these scripts. Using accuweather.com doesn't show the location code like what is supposed to be shown. It shows: http://www.accuweather.com/en/us/grove- … ast/335120. How can I adapt this script to use that weather location?

Offline

#56 2011-12-27 10:23:52

handy
Member
From: Oz
Registered: 2008-03-26
Posts: 719

Re: Conky - Really Simple Weather Script

Thanks kaikaizi, the script in your post_47 (which I saved as 3.weathers.sh) with the last line changed as per skunktrader's recommendation above in post_52, has put the icing on the cake! big_smile

Thanks to all concerned with this great thread it has refreshed my memory (its been years since last I used conky) & allowed me to grab bits & modify them from a number of conky scripts in this thread, all of which has given me the conky that I wanted all in one day... smile

By the way the following is setup for a 1600x1200 res' display, so adjustments will be required when using lower res'.


background no
use_xft yes
xftfont Bitstream Vera Sans Mono:size=18
xftalpha 0.8
update_interval 3.0
total_run_times 0
own_window yes
own_window_type override
own_window_transparent yes
own_window_colour hotpink
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 50 5
maximum_width 500
draw_shades yes
draw_outline no
draw_borders no
draw_graph_borders yes
stippled_borders 8
border_width 1
default_color white
default_shade_color black
default_outline_color black
color1 slategrey
color2 ffffff
color3 7d7d7d
alignment top_left
gap_x 30
gap_y 5
no_buffers yes
uppercase no
cpu_avg_samples 1
net_avg_samples 2
override_utf8_locale yes
max_port_monitor_connections 256

TEXT
${font Sans:bold:size=16}${color1}${time %A, %d %B %Y}${alignr}${font Sans:bold:size=16}${time %T}

${alignc}${execi 300 /home/handy/3.weathers.sh "OCN|AU|NSW|TAREE|"}

${color3}Kernel: ${color1}$kernel${color3}       ${alignr}Uptime: ${color1}$uptime 
${color3}Frequency: ${color1}${alignr}$freq_g GHz

${alignc}${color3}CPU Cores:${color1}

${cpu cpu0}% ${cpubar cpu0 10,190}${alignr}${cpu cpu1}% ${alignr}${cpubar cpu1 10,190}
${cpu cpu2}% ${cpubar cpu2 10,190}${alignr}${cpu cpu3}% ${alignr}${cpubar cpu3 10,190}


${font Sans:bold:size=16}${color3}RAM: ${font Sans:bold:size=16}${color1}${alignr}$memperc% ${alignr}${color1}${membar 15,350}


${font Sans:bold:size=16}${color3}${alignc}Disks:

${font Sans:bold:size=16}${color1}/: ${alignr}${fs_used_perc /} % ${alignr}${fs_bar 10,200 /}
${font Sans:bold:size=16}/home: ${alignr}${fs_used_perc /home} % ${alignr}${fs_bar 10,200 /home}
${font Sans:bold:size=16}/spacy-2: ${alignr}${fs_used_perc /mnt/spacy-2} % ${alignr}${fs_bar 10,200 /mnt/spacy-2}


${font Sans:bold:size=16}${color3}${alignc}Network:
${font Sans:bold:size=15}${color1}Down: ${alignr}${downspeed eth0} k/s
${font Sans:bold:size=15}Up:      ${alignr}${upspeed eth0} k/s
${font Sans:bold:size=15}Total Down: ${alignr}${totaldown eth0}
${font Sans:bold:size=15}Total Up: ${alignr}${totalup eth0}


${color3}${font Sans:bold:size=16}Top Processes:${alignr}CPU   MEM${color1}

${top name 1} ${alignr} ${top cpu 1} ${top mem 1}
${top name 2} ${alignr} ${top cpu 2} ${top mem 2}
${top name 3} ${alignr} ${top cpu 3} ${top mem 3}
${top name 4} ${alignr} ${top cpu 4} ${top mem 4}
${top name 5} ${alignr} ${top cpu 5} ${top mem 5}

${font Sans:bold:size=16}${color3}${alignc}System Log
${hr 1}
${font Sans:normal:size=13}${color1}${exec dmesg | uniq | tail -n 5}

Last edited by handy (2011-12-27 12:28:38)


I used to be surprised that I was still surprised by my own stupidity, finding it strangely refreshing.
Well, now I don't find it refreshing.
I'm over it!

Offline

#57 2012-01-31 17:16:38

Sector11
Banned
Registered: 2010-02-25
Posts: 10

Re: Conky - Really Simple Weather Script

rwp0921 wrote:

@retrodanny: Thanks but your method failed for me, but led me to the partner..netweather. Then I found their link which worked for me. You need to fill out the form for your location, it will generate an html snippet for a web page (no signup req'd). The location code is in the html snippet ASI|TW|TW018|HSINCHU in my case :-)

http://netweather.accuweather.com/adcbi … -page2.asp

Thanks for this, I was going NUTZ trying to find my location.
I'd like to add - go right through Step 1 to/and including Step 3 - grab the HTML code and back out... Unless you have a web page to put it on  big_smile

And another note, if your city had a space in the name get rid of it:

  14:04:08 ~
         $ acc_w.sh
/home/sector11/bin/acc_w.sh: 21: [: SAM|AR|AR007|BUENOS: unexpected operator

  14:04:10 ~
         $ acc_w.sh
Hazy Sunshine: 30C
  14:04:27 ~
         $

Does not work:

LOCCOD="SAM|AR|AR007|BUENOS AIRES"

Works:

LOCCOD="SAM|AR|AR007|BUENOSAIRES"

even thought it's only 25.8° here at the moment.

Now to grab a newer copy of the code.  »»» KUDOS to buttons «««

Did what "handy" did - works great.  Hi handy!  big_smile
Still no space in CITYNAME:

  14:58:48 ~
         $ acc_w_2.sh "SAM|AR|AR007|BUENOSAIRES"
WEATHER:
     Now: Hazy Sunshine, 32C
   Today: 21-36C Hot with increasing clouds 
Tomorrow: 19-37C Sunny and hot  
  14:58:51 ~
         $ acc_w_2.sh "SAM|AR|AR007|BUENOS AIRES"
/home/sector11/bin/acc_w_2.sh: line 3: [: SAM|AR|AR007|BUENOS: binary operator expected
WEATHER:
     Now: 
   Today: 
Tomorrow: 
  14:59:01 ~
         $

So I made an alias:

alias now='acc_w_2.sh "SAM|AR|AR007|BUENOSAIRES"'

Last edited by Sector11 (2012-01-31 18:02:03)

Offline

#58 2012-05-04 00:59:01

figuedmundo
Member
Registered: 2012-05-04
Posts: 1

Re: Conky - Really Simple Weather Script

Hi..
Well I had been trying these scripts and for my location it seem does not work...

#terminal
$ sh  weather.sh "SAM|AR|AR007|BUENOSAIRES"
Clear: 17Ced
$  sh weather.sh "SAM|BO|BL002|COCHABAMBA"  #my location
<nothing blank>
$
###

I was trying diferent locations and it works in Europa, and in some citys en Sud America

Any sugestion??

Tnks in advance.... btw sorry for my english

Offline

#59 2012-11-20 21:48:45

dcarrco
Member
Registered: 2012-11-20
Posts: 1

Re: Conky - Really Simple Weather Script

i tried to use this code and it didnt work.  i changed it to this (which works on crunchbang 11) and called it with this linein .conkyrc:

${execi 1800 /home/dcarrco/bin/weather1.sh 32211}

# !/usr/bin/bash
METRIC=0 #Should be 0 or 1; 0 for F, 1 for C
if [ -z $1 ]; then
    echo "USAGE: weather.sh <locationcode>"
    exit 0;
fi

wget -q http://rss.accuweather.com/rss/liveweat … ocCode\=$1 -O - | awk \
'/Currently:/ {CurWeather=$0}
/[0-9] Forecast<\/title>/ {nr=NR+3}
NR==nr    {postIndx[++x]=$0}
# x>2    {exit}
END{
    split(CurWeather,tmp,"Currently: ")
    split(tmp[2],tmp1,"<")
    CurWeather=sprintf("%s",tmp1[1])
    sub(":",",",CurWeather)
    for(x in postIndx){
    split(postIndx[x],tmp,";|&")
    split(tmp[1],tmp,">")
    split(tmp[2],statement," F ") # substitute C for F if metric differs
    split(tmp[2],temp)
    forecast[++y]=sprintf("%d-%dF %-15s",temp[5],temp[2],statement[3])
    }
    printf("%s\n%s\n%s",CurWeather,forecast[1],forecast[2])
}'

Offline

#60 2012-11-22 14:34:19

Paramvir
Member
Registered: 2009-08-06
Posts: 135
Website

Re: Conky - Really Simple Weather Script

I have noticed a lot of want for a weather program and many are working for various solutions including myself. big_smile

Well - I finally came up with a solution using only wunderground - conkywx

https://bbs.archlinux.org/viewtopic.php?id=142640

that is the thread - the package is in the AUR and it works - why not give it a run

screenshot

conkywx-screenshot.jpg

These are example templates.

cheers

Last edited by Paramvir (2012-11-22 14:35:08)

Offline

#61 2013-07-08 07:44:32

vatriani
Member
From: Germany
Registered: 2013-07-08
Posts: 2

Re: Conky - Really Simple Weather Script

For germans i've write an native c programm to fetch weather data from weather.tuxnet24.de.
But now it works only for german gmxx codes.

The programm is uploaded at github and works faster like scripts and intergate very well in conky.

features:
- small size
- fast execution time
- full output of available informations
- short output for using in conky
- format parsing like "date '%Y-%m-%D'"
- linking actual image for displaying in conky (only possible for now by installing images over make install)
- only libc is required
- opional Database support for fetching gmxx code from german cities

available under https://github.com/vatriani/weather-cli

Upcomming/planed features:
- fetching weatherstats for every country (needs an source) and parsing
- conky sample config (needs only to upload)
- more image sets


I hope you enjoy the programm.
The code is based on the idea of dietlibc so it needs no more dependencies of other frameworks.
But for now it compile with dietlibc but it don't run.

Offline

#62 2013-11-01 09:00:13

broka
Member
Registered: 2013-11-01
Posts: 1

Re: Conky - Really Simple Weather Script

pyther wrote:
Alexdsan wrote:

Hi.

How to convert the state of the time for another language?

example:
Cloudy = Nublado
Sunny = Ensolarado
T-Storms = Pancada
....

Here you go... it should be straight forward on how to add a new item, just follow the syntax...
Feel free to ask any questions...

#!/bin/sh
#AccuWeather (r) RSS weather tool for conky
#
#USAGE: weather.sh <locationcode>
#
#(c) Michael Seiler 2007

METRIC=0 #Should be 0 or 1; 0 for F, 1 for C

if [ -z $1 ]; then
    echo
    echo "USAGE: weather.sh <locationcode>"
    echo
    exit 0;
fi

#curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 | perl -ne 'if (/Currently/) {chomp;/\<title\>Currently: (.*)?\<\/title\>/; print "$1"; }'

out=`curl --connect-timeout 30 -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$1 | perl -ne 'if (/Currently/) {chomp;/\<title\>Currently: (.*)?\<\/title\>/; print "$1"; }'`

#echo $out

cond=`echo $out | cut -d':' -f 1`
temp=`echo $out | cut -d':' -f 2`

case "$cond" in

'Fog')
    echo -e "Nombre\c"
;;
'Snow')
    echo -e "Nevado\c"
;;
'Cloudy')
    echo -e "Nublado\c"
;;
'Sunny')
   echo -e "Ensolarado\c"
;;
'T-Storms')
   echo -e "Pancada\c"
;;
*)
   echo -e  $cond'\c'
esac

echo : $temp



----------------------------------------------------------------------0--------------------------------------------------------------------------




HOW I CAN DO the same for this code:

curl --silent "http://xml.weather.yahoo.com/forecastrss?p=CIXX0020&u=c"| sed -e '/C<BR\|Low/!d; s/<.*>//'


For example the output get

Mostly Cloudy, 11 C                                                                                                           
Fri - Partly Cloudy. High: 24 Low: 8                                                                                         
Sat - Sunny. High: 27 Low: 11                                                                                                 
Sun - Sunny. High: 30 Low: 12                                                                                                 
Mon - Sunny. High: 28 Low: 11                                                                                                 
Tue - Sunny. High: 26 Low: 9   

And i Want Translate all these words in spanish

Offline

#63 2019-11-06 19:23:08

sbh7600
Member
Registered: 2019-11-06
Posts: 1

Re: Conky - Really Simple Weather Script

Hello, can it be made. so shows someones city ?

METRIC=1  # 0 for F, 1 for C
# Fill in form to find your weather code here: 
# http://netweather.accuweather.com/signup-page2.asp
# If code has a space remove it or replace it with %20 or a dash; -
LOCCOD="STRUER"  #Example: NAM|MX|MX009|MEXICO-CITY

if [ -z $1 ] && [ -x $LOCCOD ] ; then
        echo
        echo "USAGE: $0 [locationcode]"
        echo
        exit 0;
elif [ ! -z $1 ] ; then
        LOCCOD=$1
fi

curl -s http://rss.accuweather.com/rss/liveweather_rss.asp\?metric\=${METRIC}\&locCode\=$LOCCOD \
| sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p'

Offline

Board footer

Powered by FluxBB