SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#2 Re: Tips, Tricks & Scripts » Conky weather+moon scripts (Accuw/WUndergr/NWS/Weather.com/Lunaf.com) » 2013-03-31 06:16:26

Hi everybody,

is it only me (or did I miss something ?) or other international users of 1d1 have noticed that Forecast images don't work anymore ?

When I searched for the "icon i-" pattern the script was getting from the curr_cond_raw file, I found icon names like "icon i-xx-s", which results in a line like "xx" in the curr_cond file, where xx is just a number. So, when the scripts executes "cp $HOME/.Conky/accuweather/Forecast_Images/$(sed -n 27p $HOME/.Conky/accuweather/curr_cond).png $HOME/.Conky/accuweather/cc.png", you get a file like, for example "12.png", or "21.png", etc...
And the images in the "Forecast_Images" folder don't have have this scheme of naming (it's like "1su.png", etc...). As a result, since yesterday I have noticed, old images get stuck in the conky.

I have been travelling through the medias used on the accuweather page and I have seen that the adress of the images used is like "vortex.accuweather.com/adc2010/images/icons-numbered/07-l.png" (shortcut, the large version, to keep the same size as the ones in the original Forecast_Images folder).

These are nice images that use transparency, so I downloaded them, changed the name according to the output of the script in the different files (no zero i.e. 1 digit numbers, so "1.png", not "01.png"), started using them and it's fine ! big_smile

And something different: it appears that the "Precipitation(1 hr): " pattern doesn't exist anymore on the accuweather page (for the moment...). Is it possible to delete it safely in the script ?

Thanks !!

#3 Re: Tips, Tricks & Scripts » Conky weather+moon scripts (Accuw/WUndergr/NWS/Weather.com/Lunaf.com) » 2013-03-26 17:35:34

Hi everybody,

@Teo:

Of course, here you go:

# — Conky settings — #

update_interval 1
total_run_times 0
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 4096
imlib_cache_size 0

temperature_unit celsius

# — Window specifications — #

own_window yes
own_window_type normal
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

border_inner_margin 0
border_outer_margin 0

minimum_size 350
maximum_width 350

alignment tl

gap_x 20
gap_y 180

# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont Droid sans:size=8 
xftalpha 1.0

uppercase no
use_spacer right

color1 AAAAAA
color2 666666
color3 0099FF


TEXT

${execi 300 bash $HOME/.Conky/accuweather/accuw_script}

${voffset -13}${font Droid sans:size=14}${color1}${goto 20}MAVP
${voffset -5}${goto 25}${font Droid sans:size=8}${color1}H:${goto 45}${color2}${execpi 300 sed -n '3p' $HOME/.Conky/Davis_weatherlink/cond_actuelles}%${voffset 12}${color1}${goto 25}P:${goto 45}${color2}${execpi 300 sed -n '4p' $HOME/.Conky/Davis_weatherlink/cond_actuelles}${voffset 12}${goto 25}${color1}V:${goto 45}${color2}${execpi 300 sed -n '31p' $HOME/.Conky/accuweather/curr_cond} - ${execpi 300 sed -n '32p' $HOME/.Conky/accuweather/curr_cond}${voffset 12}${goto 25}${color1}PA:${goto 45}${color2}${execpi 300 sed -n '5p' $HOME/.Conky/Davis_weatherlink/cond_actuelles} ${font Arrows:size=12}${execpi 300 sed -n '6p' $HOME/.Conky/Davis_weatherlink/cond_actuelles}${voffset 10}${goto 25}${font Droid sans:size=8}${color1}Pr:${goto 45}${color2}${execpi 300 sed -n '1p' $HOME/.Conky/Davis_weatherlink/prevision_12h}${voffset -55}${goto 257}${font Droid sans:size=18}${color1}${execpi 300 sed -n '1p' $HOME/.Conky/Davis_weatherlink/cond_actuelles}°${voffset 24}${goto 283}${font Droid sans:size=8}${color2}${execpi 300 sed -n '39p' $HOME/.Conky/accuweather/curr_cond}${voffset 12}${goto 283}${color2}${execpi 300 sed -n '40p' $HOME/.Conky/accuweather/curr_cond}
${voffset 18}${font Droid sans:size=8}${color1}${goto 20}${execpi 300 sed -n '3p' $HOME/.Conky/accuweather/first_days}°${goto 85}${color1}${execpi 300 sed -n '8p' $HOME/.Conky/accuweather/first_days}°${goto 150}${color1}${execpi 300 sed -n '13p' $HOME/.Conky/accuweather/first_days}°${goto 215}${color1}${execpi 300 sed -n '18p' $HOME/.Conky/accuweather/first_days}°${goto 280}${color1}${execpi 300 sed -n '23p' $HOME/.Conky/accuweather/first_days}°
${voffset 5}${font Droid sans:size=8}${color2}${goto 20}${execpi 300 sed -n '4p' $HOME/.Conky/accuweather/first_days}°${color2}${goto 85}${execpi 300 sed -n '9p' $HOME/.Conky/accuweather/first_days}°${color2}${goto 150}${execpi 300 sed -n '14p' $HOME/.Conky/accuweather/first_days}°${color2}${goto 215}${execpi 300 sed -n '19p' $HOME/.Conky/accuweather/first_days}°${color2}${goto 280}${execpi 300 sed -n '24p' $HOME/.Conky/accuweather/first_days}°
${voffset 3}${font Droid sans:size=8}${color1}${goto 48}Auj${goto 113}${execpi 300 sed -n '5p' $HOME/.Conky/accuweather/first_days}${goto 178}${execpi 300 sed -n '10p' $HOME/.Conky/accuweather/first_days}${goto 243}${execpi 300 sed -n '15p' $HOME/.Conky/accuweather/first_days}${goto 308}${execpi 300 sed -n '20p' $HOME/.Conky/accuweather/first_days}
${image $HOME/.Conky/accuweather/cc.png -p 115,35 -s 130x78}${image $HOME/.Conky/accuweather/Grey_sunrise.png -p 259,88 -s 18x18}
${if_match "${execpi 300 sed -n '1p' $HOME/.Conky/accuweather/curr_cond}" == "Today"}${image $HOME/.Conky/accuweather/tod.png -p 30,125 -s 55x33}${else}${image $HOME/.Conky/accuweather/ton.png -p 30,125 -s 55x33}${endif}${image $HOME/.Conky/accuweather/6.png -p 95,125 -s 55x33}${image $HOME/.Conky/accuweather/11.png -p 160,125 -s 55x33}${image $HOME/.Conky/accuweather/16.png -p 225,125 -s 55x33}${image $HOME/.Conky/accuweather/21.png -p 290,125 -s 55x33}

Modified accuweather script:

#!/bin/bash

#function: test_image_day
test_image_day () {
    case $1 in
         su)
           echo 1su
         ;;
         msu)
           echo 2msu
         ;;
         psu)
           echo 3psu
         ;;
         ic)
           echo 4ic
         ;;
         h)
           echo 5h
         ;;
         mc)
           echo 6mc
         ;;
         c)
           echo 7c
         ;;
         d)
           echo 8d
         ;;
         f)
           echo 9f
         ;;
         s)
           echo 10s
         ;;
         mcs)
           echo 11mcs
         ;;
         psus)
           echo 12psus
         ;;
         t)
           echo 13t
         ;;
         mct)
           echo 14mct
         ;;
         psut)
           echo 15psut
         ;;
         r)
           echo 16r
         ;;
         fl)
           echo 17fl
         ;;
         mcfl)
           echo 18mcfl
         ;;
         psfl)
           echo 19psfl
         ;;
         sn)
           echo 20sn
         ;;
         mcsn)
           echo 21mcsn
         ;;
         i)
           echo 22i
         ;;
         sl)
           echo 23sl
         ;;
         fr)
           echo 24fr
         ;;
         rsn)
           echo 25rsn
         ;;
         w)
           echo 26w
         ;;
         ho)
           echo 27ho
         ;;
         co)
           echo 28co
         ;;
         cl)
           echo 29cl 
         ;;
         mcl)
           echo 31mcl
         ;;
         pc)
           echo 32pc 
         ;;
         pcs)
           echo 36pcs
         ;;
         pct)
           echo 38pct 
         ;;
        esac
} 

#function: test_image_night
test_image_night () {
    case $1 in
		 su)
           echo 1su
         ;;
         msu)
           echo 2msu
         ;;
         psu)
           echo 3psu
         ;;
         c)
           echo 7c
         ;;
         d)
           echo 8d
         ;;
         f)
           echo 9f
         ;;
         s)
           echo 10s
         ;;
         psus)
           echo 12psus
         ;;
         t)
           echo 13t
         ;;
         psut)
           echo 15psut
         ;;
         r)
           echo 16r
         ;;
         fl)
           echo 17fl
         ;;
         psfl)
           echo 19psfl
         ;;
         sn)
           echo 20sn
         ;;
         i)
           echo 22i
         ;;
         sl)
           echo 23sl
         ;;
         fr)
           echo 24fr
         ;;
         rsn)
           echo 25rsn
         ;;
         ho)
           echo 27ho
         ;;
         co)
           echo 28co
         ;;
         cl)
           echo 29cl 
         ;;
         w)
           echo 30w
         ;;
         mcl)
           echo 31mcl
         ;;
         pc)
           echo 32pc 
         ;;
         ic)
           echo 33ic
         ;;
         h)
           echo 34h
         ;;
         mc)
           echo 35mc 
         ;;
         pcs)
           echo 36pcs
         ;;
         mcs)
           echo 37mcs 
         ;;
         pct)
           echo 38pct 
         ;;
         mct)
           echo 39mct 
         ;;
         mcfl)
           echo 40mcfl 
         ;;
         mcsn)
           echo 41mcsn 
         ;;
        esac
}


#put your Accuweather address here
address="http://www.accuweather.com/en/re/salazie/1131695/weather-forecast/1131695"

loc_id=$(echo $address|sed 's/\/weather-forecast.*$//'|sed 's/^.*\///')
last_number=$(echo $address|sed 's/^.*\///')

curr_addr="$(echo $address|sed 's/weather-forecast.*$//')"current-weather/"$last_number"

addr1="$(echo $address|sed 's/weather-forecast.*$//')"daily-weather-forecast/"$last_number"
addr2="$addr1"?day=6

kill -STOP $(pidof conky)
killall wget

wget -O $HOME/.Conky/Davis_weatherlink/cond_actuelles_brut http://www.weatherlink.com/user/salazie/index.php?view=main&headers=0
wget -O $HOME/.Conky/Davis_weatherlink/prevision_12h_brut http://www.weatherlink.com/user/salazie/index.php?view=summary&headers=0
wget --save-cookies $HOME/.Conky/accuweather/cookie -O $HOME/.Conky/accuweather/curr_cond_raw $curr_addr
wget --load-cookies $HOME/.Conky/accuweather/cookie -O $HOME/.Conky/accuweather/first_days_raw $addr1


#Current Conditions - curr_cond file
if [[ -s $HOME/.Conky/accuweather/curr_cond_raw ]]; then

    egrep -i '"detail-tab-panel |>Today<\/a>|>Tonight<\/a>|>Early AM<\/a>|>Overnight<\/a>|>Mon<\/a>|>Tue<\/a>|>Wed<\/a>|>Thu<\/a>|>Fri<\/a>|>Sat<\/a>|>Sun<\/a>|icon i-|"cond"|"temp"|var d = '\''|var s = '\''|Humidity: |Pressure: |Cloud Cover: |UV Index: |Dew Point: |Precipitation(1 hr): |Visibility: |"start">|"finish">' $HOME/.Conky/accuweather/curr_cond_raw > $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/^[ \t]*//g' -e 's/^.*icon i-//g' -e 's/^.*"cond">//g' -e 's/>Lo</\n/g' -e 's/RealFeel/\n/g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/^.*"#">//g' -e 's/^.*<strong class="temp"//g' -e 's/^>//g' -e 's/<span>&deg.*$//g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/<\/a>.*$//g' -e 's/\/span> //g' -e 's/var d = //g' -e 's/var s = //g' -e 's/"temp">/\n/g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/^.*"start">//g' -e 's/^.*"finish">//g' -e 's/<li>//g' -e 's/<strong>//g' -e 's/<<span.*$//g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/<\/span>//g' -e 's/<\/strong><\/li>//g' -e 's/ "><\/div>//g' -e 's/'\''//g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/"><\/div>//g' -e 's/^.*; //g' -e 's/&#.*$//g' -e 's/ i-alarm.*$//g' -e 's/;//g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/Humidity: //g' -e 's/Pressure: //g' -e 's/Cloud Cover: //g' -e 's/UV Index: //g' -e 's/Dew Point: //g' -e 's/Visibility: //g' $HOME/.Conky/accuweather/curr_cond
    sed -i -e 's/^.*detail-tab-panel //g' -e 's/">//g' -e 's/\r//g' -e 's/ *$//g' -e 's/mb.*$/mb/g' $HOME/.Conky/accuweather/curr_cond
    sed -i 's/-s\|-xl.*$//g' $HOME/.Conky/accuweather/curr_cond
    time=$(sed -n 1p $HOME/.Conky/accuweather/curr_cond)
    if [[ $time == Tonight || $time == Overnight || $time == "Early AM" ]]; then
        sed -i 3a- $HOME/.Conky/accuweather/curr_cond
	fi
    line35=$(sed -n 35p $HOME/.Conky/accuweather/curr_cond)
    sed -i '35d' $HOME/.Conky/accuweather/curr_cond
    sed -i 35a$line35 $HOME/.Conky/accuweather/curr_cond
	cp $HOME/.Conky/accuweather/Forecast_Images/$(sed -n 27p $HOME/.Conky/accuweather/curr_cond).png $HOME/.Conky/accuweather/cc.png
fi


#First 5days - first_days file 
if [[ -s $HOME/.Conky/accuweather/first_days_raw ]]; then

    sed -i '/<div class="column-1 clearfix">/,/<div id=\"feature-history\">/!d' $HOME/.Conky/accuweather/first_days_raw
    egrep -i '>Today<|<p>[a-z]|>Mon<\/a>|>Tue<\/a>|>Wed<\/a>|>Thu<\/a>|>Fri<\/a>|>Sat<\/a>|>Sun<\/a>|icon i-|"cond"|"temp"|realfeel">RealFeel|realfeel">Precipitation' $HOME/.Conky/accuweather/first_days_raw > $HOME/.Conky/accuweather/first_days

    sed -i -e 's/^[ \t]*//g' -e 's/^.*icon i-//g' -e 's/^.*"cond">//g' -e 's/>Lo</\n/g' $HOME/.Conky/accuweather/first_days
    sed -i -e 's/ "><\/div>//g' -e 's/"><\/div>//g' -e 's/^.*"temp">//g' -e 's/<span>&deg.*$//g' $HOME/.Conky/accuweather/first_days
    sed -i -e 's/<p>//g' -e 's/<\/p>//g' -e 's/^.*"#">//g' -e 's/\/span> //g' -e 's/^.*>Precipitation //g' -e 's/^.*; //g' $HOME/.Conky/accuweather/first_days
    sed -i -e 's/&#.*$//g' -e 's/<.*$//g' -e 's/ i-alarm.*$//g' -e 's/\r//g' -e 's/ *$//g' $HOME/.Conky/accuweather/first_days
	sed -i -e 's/Today/TODAY/' -e 's/Mon$/Lun/' -e 's/Tue$/Mar/' -e 's/Wed$/Mer/' -e 's/Thu$/Jeu/' -e 's/Fri$/Ven/' -e 's/Sat$/Sam/' -e 's/Sun$/Dim/' $HOME/.Conky/accuweather/first_days
    sed -i 's/-s\|-l.*$//g' $HOME/.Conky/accuweather/first_days
    time=$(sed -n 1p $HOME/.Conky/accuweather/curr_cond)
    if [[ $time == Tonight || $time == Overnight || $time == "Early AM" ]]; then
        sed -i 2a- $HOME/.Conky/accuweather/first_days
	fi
	L1=$(sed -n 1p $HOME/.Conky/accuweather/first_days)
    if [[ $L1 == TODAY ]]; then
        sed -i 1d $HOME/.Conky/accuweather/first_days
	fi
    for (( i=6; i<=21; i+=5 ))
	  do
	      cp $HOME/.Conky/accuweather/Forecast_Images/$(sed -n ${i}p $HOME/.Conky/accuweather/first_days).png $HOME/.Conky/accuweather/$i.png
	  done
	cp $HOME/.Conky/accuweather/Forecast_Images/$(sed -n 25p $HOME/.Conky/accuweather/first_days).png $HOME/.Conky/accuweather/tod.png
	cp $HOME/.Conky/accuweather/Forecast_Images/$(sed -n 30p $HOME/.Conky/accuweather/first_days).png $HOME/.Conky/accuweather/ton.png

fi


#Conditions locales MAVP
if [[ -s $HOME/.Conky/Davis_weatherlink/cond_actuelles_brut ]]; then

	egrep -i 'glamor_temp|glamor_datatemp|glamor_detailtemp' $HOME/.Conky/Davis_weatherlink/cond_actuelles_brut>$HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '2,6d' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '6d' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '4d' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '1s/^.*Black">//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '1s/<span.*$//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '2s/^.*Gust&nbsp;//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i 's/^.*Black">//g' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '2s/<span.*$//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '3s/<span.*$//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i 's/<\/span.*$//g' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '6s/^.*nowrap>//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i '6s/<\/td>//' $HOME/.Conky/Davis_weatherlink/cond_actuelles
	sed -i -e 's/Falling Slowly/H/' -e 's/Falling Rapidly/HH/' -e 's/Rising Slowly/G/' -e 's/Rising Rapidly/GG/' -e 's/Steady/A/' $HOME/.Conky/Davis_weatherlink/cond_actuelles

fi


#Prévisions 12h MAVP
if [[ -s $HOME/.Conky/Davis_weatherlink/prevision_12h_brut ]]; then

	egrep -i 'colspan="5"' $HOME/.Conky/Davis_weatherlink/prevision_12h_brut>$HOME/.Conky/Davis_weatherlink/prevision_12h
	sed -i 's/^.*"5">//' $HOME/.Conky/Davis_weatherlink/prevision_12h
	sed -i 's/<\/td>.*$//' $HOME/.Conky/Davis_weatherlink/prevision_12h
	sed -i -e 's/Rain within 12 hours/Pluie/' -e 's/Partially Cloudy/Nuages épars/' -e 's/Mostly Clear/Temps clair/' -e 's/Mostly Cloudy/Nuages/' $HOME/.Conky/Davis_weatherlink/prevision_12h

fi


kill -CONT $(pidof conky)

Thanks and sorry for the long post !!



EDIT (31-03-2013): I eventually have only one accuweather modified script. The last two parts are used to grab the local weather conditions here, but you can replace it with other variables from the original files produced by the 1d1 script.

#4 Re: Tips, Tricks & Scripts » Conky weather+moon scripts (Accuw/WUndergr/NWS/Weather.com/Lunaf.com) » 2013-03-25 17:38:20

Hi everybody (and big bigup to Master Teo),

First post here though I use Conky Accuweatherscripts for quite a long time now.
Just to show you the widget-style conky I have built thanks to your wonderful scripts.
Part of it also comes from a script I have tried to write on your basis (especially the bar trend for pressure) that fetches infos from another website (reason is I live in a remote area where even accuweather is not that accurate).

Zoom:

iWr6ZsLs.jpg

Context:

BYtKhPrs.jpg

Thanks again for the tremendous job !

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo