SEARCH

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

You are not logged in.

#651 2012-03-09 15:03:03

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

lionhead wrote:

it seems that the 'sunny-error' happens only sometimes?!

btw: nice template! do u wanna share it wink

I think I already have ---- but since you ask who am I to say no!  big_smile

9a3b9e178900245.jpg

lua_load ~/v9000/v9000.lua
lua_draw_hook_post weather
lua_load ~/Conky/templates/h-10d-template.lua

TEXT

~/Conky/templates/h-10d-template.lua

--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/

 the file:
http://dl.dropbox.com/u/19008369/v9000.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/

sun_rise_24[n]
sun_set_24[n]
moon_rise_24[n]
moon_set_24[n]
now["time_24"]
now["fc_hour1_time_24"]
now["fc_hour2_time_24"]
now["fc_hour3_time_24"]

]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Anonymous Pro:bold"--font must be in quotes
default_font_size=11
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE
out({c=0x00BFFF,a=1,x=10,y=15,txt=now["date"].." "..now["month_short"].." "..now["year"]..": Fetched @ "..now["time_24"]})
image({x=20,y=20,h=40,w=40,file=now["weather_icon"]})
-- Temp / FeelsLike & CONDITIONS TEXT
out({c=0x48D1CC,a=1,f="Digital-7",fs=50,x=80,y=60,txt=now["temp"]})
out({c=0x00BFFF,a=1,f="Digital-7",fs=50,x=140,y=60,txt=now["feels_like"]})
out({c=0xA4FFA4,a=1,x=81,y=72,txt="Temp          WC · HI"})

out({c=0x48D1CC,a=1,f="Zekton",fs=18,x=10,y=94,txt=now["conditions_short"]})

-- data titles
--    data output 
datay=110   -- y=datay or
datayy=15   -- y=datay+(datayy*1) use 1 or more

out({c=0xFAFAEC,a=1,x=10,y=datay,txt="Wind Chill:"})
   out({c=0x48D1CC,a=1,x=70,y=datay,txt=now["wind_chill"].."°"})
out({c=0xFAFAEC,a=1,x=100,y=datay,txt="Heat Index:"})
   out({c=0xFF8C00,a=1,x=165,y=datay,txt=now["heat_index"].."°"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*1),txt="Today's Hi·Lo:"})
   out({c=0xFF8C00,a=1,x=100,y=datay+(datayy*1),txt=high_temp[1].."°"})
   out({c=0x48D1CC,a=1,x=140,y=datay+(datayy*1),txt=low_temp[1].."°"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*2),txt="Wind:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*2),txt=now["wind_km"]})
   out({c=0x48D1CC,a=1,x=110,y=datay+(datayy*2),txt=now["wind_nesw"]})
   out({c=0xFAFAEC,a=1,x=140,y=datay+(datayy*2),txt="@"})
   out({c=0x48D1CC,a=1,x=165,y=datay+(datayy*2),txt=now["wind_deg"]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*3),txt="Hum:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*3),txt=now["humidity"].."%"})
out({c=0xFAFAEC,a=1,x=110,y=datay+(datayy*3),txt="DP:"})
   out({c=0x48D1CC,a=1,x=145,y=datay+(datayy*3),txt=now["dew_point"].."°"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*4),txt="Bar:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*4),txt=now["pressure_mb"]})
out({c=0xFAFAEC,a=1,x=110,y=datay+(datayy*4),txt="Vis:"})
   out({c=0x48D1CC,a=1,x=145,y=datay+(datayy*4),txt=now["visibility"]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*5),txt="Ceil:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*5),txt=now["ceiling"]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*6),txt="Precip:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*6),txt=precipitation[1].."%"})
out({c=0xFAFAEC,a=1,x=110,y=datay+(datayy*6),txt="Cloud:"})
   out({c=0x48D1CC,a=1,x=150,y=datay+(datayy*6),txt=cloud_cover[1].."%"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*7),txt="UV:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*7),txt=uv_index_num[1]})
   out({c=0x48D1CC,a=1,x=110,y=datay+(datayy*7),txt=uv_index_txt[1]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*8),txt="Sun:"})
   out({c=0xFAFAEC,a=1,x=60,y=datay+(datayy*8),txt=sun_rise_24[1]})
   out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*8),txt=sun_set_24[1]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*9),txt="Moon:"})
   out({c=0xFAFAEC,a=1,x=60,y=datay+(datayy*9),txt=moon_rise_24[1]})
   out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*9),txt=moon_set_24[1]})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*10),txt="Phase:"})
   out({c=0x48D1CC,a=1,x=60,y=datay+(datayy*10),txt=moon_phase[1]})

-- line
image({x=205,y=5,w=1,h=260,file="/home/sector11/Conky/images/cyan-1.png"})
-- 3 hour output
out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=12,x=220,y=15,txt="Next 3"})
out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=12,x=220,y=30,txt="Hours"})
-- 1st hour
out({c=0xA4FFA4,x=220,y=50,txt=now["fc_hour1_time_24"]..":00"})
image({w=30,h=30,x=223,y=55,file=now["fc_hour1_wicon"]}) -- image({w=30,h=30,x=223,y=55,file="/home/sector11/Conky/images/red-1.png"})
out({x=228,y=100,txt=now["fc_hour1_temp"] .."°"})
-- 2nd hour
out({c=0xA4FFA4,x=220,y=datay+(datayy*1),txt=now["fc_hour2_time_24"]..":00"})
image({w=30,h=30,x=223,y=130,file=now["fc_hour2_wicon"]}) -- image({w=30,h=30,x=223,y=130,file="/home/sector11/Conky/images/red-1.png"})
out({x=228,y=180,txt=now["fc_hour2_temp"] .."°"})
-- 3rd hour
out({c=0xA4FFA4,x=220,y=210,txt=now["fc_hour3_time_24"]..":00"})
image({w=30,h=30,x=223,y=215,file=now["fc_hour3_wicon"]}) -- image({w=30,h=30,x=223,y=215,file="/home/sector11/Conky/images/red-1.png"})
out({x=228,y=datay+(datayy*10),txt=now["fc_hour3_temp"] .."°"})
-- line
image({x=275,y=5,w=1,h=260,file="/home/sector11/Conky/images/cyan-1.png"})

--start or weather forecast table section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=10
topy=15
topyy=135 -- topy+(topyy*1)
topx=285
topxx=120
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]        =topx            ,topy
   top_left_x_coordinate[2],top_left_y_coordinate[2]     =topx+(topxx*1)  ,topy
top_left_x_coordinate[3],top_left_y_coordinate[3]        =topx+(topxx*2)  ,topy
   top_left_x_coordinate[4],top_left_y_coordinate[4]     =topx+(topxx*3)  ,topy
top_left_x_coordinate[5],top_left_y_coordinate[5]        =topx+(topxx*4)  ,topy
   top_left_x_coordinate[6],top_left_y_coordinate[6]     =topx            ,topy+(topyy*1)
top_left_x_coordinate[7],top_left_y_coordinate[7]        =topx+(topxx*1)  ,topy+(topyy*1)
   top_left_x_coordinate[8],top_left_y_coordinate[8]     =topx+(topxx*2)  ,topy+(topyy*1)
top_left_x_coordinate[9],top_left_y_coordinate[9]        =topx+(topxx*3)  ,topy+(topyy*1)
   top_left_x_coordinate[10],top_left_y_coordinate[10]   =topx+(topxx*4)  ,topy+(topyy*1)
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do --start of day repeat, do not edit #######
tlx=top_left_x_coordinate[i] --sets top left x position for each repeat ##################
tly=top_left_y_coordinate[i] --sets top left y position for each repeat ##################
--########################################################################################
out({c=0xA4FFA4,a=1,x=tlx,y=tly,txt=forecast_day_short[i].."  "..forecast_date[i].."  "..forecast_month_short[i]})
image({x=tlx,y=tly+5,h=30,w=30,file=weather_icon[i]})
out({c=0xFF8C00,a=1,x=tlx+35,y=tly+15,txt=high_temp[i].."°"})
out({c=0x48D1CC,a=1,x=tlx+35,y=tly+30,txt=low_temp[i].."°"})
out({c=0x48D1CC,a=1,x=tlx,y=tly+50,txt=conditions_short[i]})

out({c=0xFAFAEC,a=1,x=tlx,y=tly+65,txt="P: "..precipitation[i].."%"})
   out({c=0xFAFAEC,a=1,x=tlx+50,y=tly+65,txt="UV: "..uv_index_num[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+80,txt="H: "..humidity[i].."%"})
    out({c=0xFAFAEC,a=1,x=tlx+50,y=tly+80,txt=uv_index_txt[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+95,txt="S: "..sun_rise_24[i]})
   out({c=0x48D1CC,a=1,x=tlx+60,y=tly+95,txt=sun_set_24[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+110,txt="M: "..moon_rise_24[i]})
   out({c=0x48D1CC,a=1,x=tlx+60,y=tly+110,txt=moon_set_24[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

Last edited by Sector11 (2012-03-09 15:03:52)

Offline

Help fund CrunchBang, donate to the project!

#652 2012-03-09 15:14:06

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

kri5 wrote:

Just decided to take a dive off the deep end and have a go myself.  I'm using the 'weather_script.lua' config and everything appears to be running fine so far but i have just one question.  What is the number in the very top right corner?

{sounds of unoiled hinges on a door opening on a dark eerie night}
Welcome, we've been waiting for you.

mrpeachy tossed in a ${cpu} in there when he wrote it to see how much cpu resources the script uses.

Right after TEXT in the conky: ~/v9000/conky_weather

TEXT
${goto 230}${cpu}

Take it out if you don't want it BUT:
WARNING: Leave a blank empty line after text!  To run "any" lua script it requires at least one line after text - used, as seen above - or blank.  But it must be there.

Last edited by Sector11 (2012-03-09 15:19:12)

Offline

#653 2012-03-09 15:33:06

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

i havnt seen mismatching icons and weather text either
all the text you see is taken directly from the html of the intellicast site

thats what the script does, downloads the page html and pulls out the information

one thing that i had to do manually is to look at each intellicast icon and pick the best matching conkyforecast icon
that is what this table is doing

wimage={
wx_65="32",  -- Clear
wx_66="30",  -- Partly Cloudy
wx_67="26",  -- Cloudy
wx_68="32",  -- Clear
wx_69="28",  -- Mostly Cloudy
wx_70="20",  -- Fog
wx_71="32",  -- Clear
wx_72="21",  -- Haze
wx_73="36",  -- Hot
wx_74="14",  -- Light Snow Showers
wx_75="28",  -- Mostly Cloudy
wx_76="18",  -- Sleet
wx_77="14",  -- Light Snow Showers
wx_78="23",  -- Blustery
wx_79="05",  -- Mixed Rain and Snow
wx_80="15",  -- Drifting Snow
wx_81="15",  -- Drifting Snow
wx_82="11",  -- Light Rain
wx_83="16",  -- Snow
wx_84="00",  -- Tornado
wx_85="32",  -- Clear
wx_86="25",  -- N/A
wx_87="09",  -- Drizzle
wx_88="05",  -- Mixed Rain and Snow
wx_89="18",  -- Sleet
wx_90="18",  -- Sleet
wx_91="39",  -- Scattered Showers
wx_92="39",  -- Scattered Showers
wx_93="39",  -- Scattered Showers
wx_94="39",  -- Scattered Showers
wx_95="37",  -- Isolated Thunderstorms
wx_96="37",  -- Isolated Thunderstorms
wx_97="31",  -- Clear
wx_98="29",  -- Partly Cloudy
wx_99="27",  -- Mostly Cloudy
wx_100="47",  -- Isolated Thunderstorms
wx_101="47",  -- Isolated Thunderstorms
wx_102="33",  -- Fair
wx_103="26",  -- Cloudy
wx_104="20",  -- Fog
wx_105="45",  -- Scattered Showers
wx_106="45",  -- Scattered Showers
wx_107="11",  -- Light Rain
wx_108="46",  -- Snow Showers
wx_109="46",  -- Snow Showers
wx_110="06",  -- Mixed Rain and Sleet
wx_111="18",  -- Sleet
wx_112="06",  -- Mixed Rain and Sleet
wx_113="46",  -- Snow Showers
wx_114="46",  -- Snow Showers
wx_115="31",  -- Clear
wx_116="47",  -- Isolated Thunderstorms
}--end w image table

which sector11 very kindly annotated for me smile

if you get different weather descriptions of rthe same icon it is because intellicast uses different descriptions but puts up the same icon (or at least an icon that looks the same)

partyly cloudy with the sun icon... i have no explaination for that currently!
ill watch out for it

@kri5 - if you need help with the customization i should be around most of the day today, so just ask!
and im sure sector11 could field some template setup questions too, i think he has made more of them than i have!

Offline

#654 2012-03-09 15:44:05

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

here is a screenshot that shows you some things:
http://ompldr.org/vY3pkdA/2012-03-09-16 … _scrot.png

1. the two different images for 'partly cloudy'  -> night and day-version
2. the script shows 'partly cloudy' and intellicast shows 'broken clouds' ? i think they 'share' the same icon!

btw: how is it possible to break clouds wink


here another screenshot:
http://ompldr.org/vY3plbQ/2012-03-09-17 … _scrot.png

intellicast: clear
desktop: partly cloudy (teilweise bewölkt)

it's good to know that the curious error appears often (and not only once)!

edit: the weather condition 'clear' also use two different images. a night and a day-version.

@mrpeachy

if u don't believe me then test it yourself smile just say something and i give you my config.

Last edited by lionhead (2012-03-09 17:48:37)


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#655 2012-03-09 18:12:44

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

lionhead wrote:

here is a screenshot that shows you some things:
http://ompldr.org/vY3pkdA/2012-03-09-16 … _scrot.png

1. the two different images for 'partly cloudy'  -> night and day-version
2. the script shows 'partly cloudy' and intellicast shows 'broken clouds' ? i think they 'share' the same icon!

btw: how is it possible to break clouds wink

here another screenshot:
http://ompldr.org/vY3plbQ/2012-03-09-17 … _scrot.png

intellicast: clear
desktop: partly cloudy (teilweise bewölkt)

it's good to know that the curious error appears often (and not only once)!

edit: the weather condition 'clear' also use two different images. a night and a day-version.

@mrpeachy

if u don't believe me then test it yourself smile just say something and i give you my config.

In your first image:
7°C   vs 8-6°C
Wind shows 19.3 km/h W vs 9mph (14.5 km/h) WSW

So it's quite possible that your conky had not refreshed yet to get the new info from IntelliCast.
When you see stuff like that, kill your conky and rerun it to see if it matches.

Mine only updates here once an hour, so by the time my conky updates the latest on IntelliCast might already have changed once or twice.

But that second one ... that a definate OH OH!

RE: Break clouds I asked the same thing.  lol

http://en.mimi.hu/meteorology/broken_clouds.html

BROKEN CLOUDS: Clouds which cover between 6/10 and 9/10 of the sky.
CEILING: The height of the lowest layer of clouds, when the sky is broken or overcast.

Clear skies allow 100% of the incoming UV radiation from the sun to reach the surface, whereas scattered clouds transmit 89%, broken clouds transmit 73%, and overcast conditions transmit 31%.

Few Clouds
An official sky cover classification for aviation weather observations, descriptive of a sky cover of 1/8 to 2/8.

Nice site.

Send me your template & config for German as well, I'l like to see if it happens here.

Offline

#656 2012-03-09 18:27:35

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

I have some new images that might work:
d5184a178936045.jpg

I grabbed icons from another site.  They didn't have ICY rain but they had icicles - which I flipped so it looks like ice on the ground with the rain adding to it.  I doubt I will ever see those here though.

And it has 2 wind images as well, with day/night or strong/light type format, and since there are 2 for what we gave ... BINGO!

Should we incorporate them?

I'm looking at converting a fog one too - not done yet.

Offline

#657 2012-03-09 18:27:49

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

its not that i dont believe you, its just that i need to see it for myself in order to be able to track down whats causing it

post your files anyway, particularly the template and the config

Offline

#658 2012-03-09 18:31:11

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

Sector11 wrote:

I have some new images that might work:
d5184a178936045.jpg

I grabbed icons from another site.  They didn't have ICY rain but they had icicles - which I flipped so it looks like ice on the ground with the rain adding to it.  I doubt I will ever see those here though.

And it has 2 wind images as well, with day/night or strong/light type format, and since there are 2 for what we gave ... BINGO!

Should we incorporate them?

I'm looking at converting a fog one too - not done yet.

you could make an icons folder that replaces all the ones that have english text
"international_icons"  and put it in the additional files folder then just point your config to it

once you get done i can add the folder to the main archive

Offline

#659 2012-03-09 18:56:07

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

here is my config-file with the german translation table:

--SETTINGS AND PREFERENCES--SETTINGS AND PREFERENCES--SETTINGS AND PREFERENCES
function weather_settings()--#### DO NOT EDIT THIS LINE #################
--#######################################################################
--[[set update interval.  update interval is based on conky cycles
if your conkyrc has an update_interval of 1, ie updates every second
then if you enter 60 below, the script will update every 60 seconds
however, if your conkyrc update_interval is 10, then by setting 60 below,
v9000 will update every 600 seconds (10 minutes)]]
local update_interval=1800 --avoid an interval of 1
--get web address by going to the intellicast site and entering your location in the box

--click on "Extended Forecast" to get the necessary address
local web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=GMXX0156"--insert unit=C& after aspx? for C
-- nur für temperatur in celsius
-- http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=GMXX0156

-- nur für temperatur in fahrenheit
-- http://www.intellicast.com/Local/Forecast.aspx?unit=F&location=GMXX0156

--set location of weather images (replace "benjamin" with your own username)
local weathericons="/home/alexander/v9000/additional_files/weathericons/"
--short conditions setup
--this section allows you to set your own shorter terms to replace the terms foud in conditions
--to use for current: now["conditions_short"], now["conditions_short_caps"], now["conditions_short_lc"]
--to use for forecast: conditions_short[n], conditions_short_caps[n], conditions_short_lc[n]
--ALSO USE THIS TABLE TO ENTER CONDITIONS TRANSLATIONS
con_short={--start of table, put entries below in form eg: ["Thunderstorm"]="T.Strm",
["AM Clouds/PM Sun"]="vormittags bewölkt/nachmittags sonnig",
["AM Rain/Snow Showers"]="vormittags Regen-/Schneeschauer",
["AM Showers"]="vormittags Regenschauer",
["AM Snow Showers/Wind"]="vormittags Schneeschauer/windig",
["AM Fog/PM Sun"]="vormittags Nebel/nachmittags Sonne",
["AM Drizzle"]="vormittags Sprühregen",
["PM Light Rain"]="nachmittags leichter Regen",
["Broken Clouds"]="überwiegend bewölkt",
["Drizzle"]="Nieselregen",
["Few Clouds"]="leichte Bewölkung",
["Few Showers"]="wenig Regenschauer",
["Few Snow Showers"]="wenig Schneeschauer",
["Freezing Rain"]="überfrierender Regen",
["Freezing Drizzle"]="überfrierender Nieselregen",
["Partly Cloudy"]="teilweise bewölkt",
["Partly Cloudy/Wind"]="teilweise bewölkt/windig",
["Haze"]="schwül/neblig",
["Heavy Rain"]="starker Regen",
["Heavy Snow"]="starker Schneefall",
["Hot"]="sehr warm",
["Isolated Thunderstorms"]="vereinzelt Gewitter",
["Light Rain"]="leichter Regen",
["Light Rain Late"]="leichter Regen nachmittags",
["Light Rain/Wind"]="leichter Regen/windig",
["Light Snow"]="leichter Schneefall",
["Fog Late"]="dichter Nebel",
["Mixed Rain and Hail"]="verm. Regen und Hagel",
["Mixed Rain and Snow"]="verm. Regen und Schnee",
["Mixed Rain and Sleet"]="verm. Regen und Graupel",
["Mixed Precipitation"]="verschiedener Niederschlag",
["Moderate Fog"]="mäßig neblig",
["Mostly Cloudy"]="meist bewölkt",
["Mostly Sunny"]="meist sonnig",
["Rain/Snow"]="Schneeregen",
["Rain/Snow Showers"]="Regen-/Schneeschauer",
["Drifting Snow"]="Treibschnee",
["Scattered Thunderstorms"]="vereinzelt Gewitter",
["Scattered Clouds"]="gering bewölkt",
["Scattered Showers"]="vereinzelt leichter Regen",
["Snow Showers"]="Schneeschauer",
["Snow Showers Late"]="Schneeschauer nachmittags",
["Snow Flurries"]="Schneeaufwirbelung",
["Showers Early"]="leichter Regen",
["Sprinkles"]="Sprühregen",
["Clear"]="klar",
["Clear/Wind"]="klar/windig",
["Blustery"]="stürmisch",
["Cloudy"]="bewölkt",
["Overcast"]="zunehmend bedeckt",
["Showers"]="Schauer",
["Sunny"]="sonnig",
["Thunderstorm"]="Sturm",
--["Thunderstorms/Wind"]="T.Storms/Wnd"
["Wind Early"]="frueh oder am morgen windig",
["Wind"]="windig", 
}--this bracket closes the table
--the script is capable of converting between several unit types
--set how many decimal places you want the conversions to show
local decimal_places=1
--some weather data options need to come with their own units attached as they can be NA on occasion
--set here what you want to have for units, or set "" for nothing
--include spaces, if desired, for formatting purposes. 
--NOTE ALSO EDIT THESE SETTINGS FOR TRANSLATION PURPOSES
local visibility_unit=" mi"
local wind_mph_unit=" mph"
local wind_km_unit=" km/h"
local wind_kts_unit=" kts"
local ceiling_unit=" ft"
local wind_degrees_unit="°"
--do you want the script to use translation tables?
--set 1 if you want to translate, 0 if not.
--the translation tables are located below
local translate=1
--set alerts on or off, set to 0 so that the script does not check for alerts
--set 1 to check for alerts
local alert_check=0
--#######################################################################
--TRANSLATION TABLES, activate by setting translate=1 above
--use con_short table above to translate weather conditions
--edit units settings above to complete translation
--translate NESW text
neswtext={
S="S",
SSW="SSW",
SW="SW",
WSW="WSW",
W="W",
WNW="WNW",
NW="NW",
NNW="NNW",
N="N",
NNE="NNO",
NE="NO",
ENE="ONO",
E="O",
ESE="OSO",
SE="SO",
SSE="SSO",
}--end of  N E S W text table
--translate time suffix
tsuffix={
AM="AM",
PM="AM",
}--end of time suffix table
--enter translations for uv index text
uvindextext={
["Low"]="gering",
["Moderate"]="mittel",
["High"]="hoch",
["Very High"]="sehr hoch",--format is different because of the space in the text
["Extreme"]="extrem",
}--end of uv text table
--enter translations for moonpahse
moonphases={
["New"]="Neumond",
["Full"]="Vollmond",
["First Quarter"]="erstes Viertel",
["Last Quarter"]="letztes Viertel",
["Waning Gibbous"]="abnehmender Mond",
["Waning Crescent"]="abnehmender Halbmond",
["Waxing Crescent"]="zunehmender Halbmond",
["Waxing Gibbous"]="zunehmender Mond", 
}--end of moon phase table
--enter translations for FULL day names
daynames={
Monday="Montag",
Tuesday="Dienstag",
Wednesday="Mittwoch",
Thursday="Donnerstag",
Friday="Freitag",
Saturday="Samstag",
Sunday="Sonntag",
}--end day names table
--enter translations for SHORT day names
dayshort={
Monday="Mo",
Tuesday="Di",
Wednesday="Mi",
Thursday="Do",
Friday="Fr",
Saturday="Sa",
Sunday="So"
}--end short day names table
--enter translation for FULL month names
monthnames={
January="Januar",
February="Februar",
March="März",
April="April",
May="Mai",
June="Juni",
July="Juli",
August="August",
September="September",
October="Oktober",
November="November",
December="Dezember"
}--end of month name translations
--enter translations for SHORT month names
monthshort={
January="Jan",
February="Feb",
March="März",
April="April",
May="Mai",
June="Juni",
July="Juli",
August="Aug",
September="Sep",
October="Okt",
November="Nov",
December="Dez"
}--end of short month name translations
--enter some additional translations
additional={
NA="t_NA",
Unl="t_Unl"--for ceiling data option
}--end of additional translations
--END OF TRANSLATION TABLES
--#######################################################################
--NOTE if you make changes to these settings, they will only take effect at the next weather update
--or after killall conky and restart
--#######################################################################
if translate==1 then
return {update_interval,web,weathericons,con_short,decimal_places,visibility_unit,wind_mph_unit,wind_km_unit,wind_kts_unit,ceiling_unit,wind_degrees_unit,translate,alert_check,neswtext,tsuffix,uvindextext,moonphases,daynames,dayshort,monthnames,monthshort,additional}
else
return {update_interval,web,weathericons,con_short,decimal_places,visibility_unit,wind_mph_unit,wind_km_unit,wind_kts_unit,ceiling_unit,wind_degrees_unit,translate,alert_check}
end
end--OF SETTINGS AND PREFERENCES ########################################
--#######################################################################

and here my template:

--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/

 the file:
http://dl.dropbox.com/u/19008369/v9000.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/
]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Anonymous Pro"--font must be in quotes
default_font_size=11
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE

image({x=20,y=10,h=80,w=80,file=now["weather_icon"]})

out({c=0xA4FFA4,a=1,f="mono",fs=15,x=140,y=40,txt=now["temp"].."°C"})
out({c=0x48D1CC,a=1,f="mono",fs=15,x=140,y=70,txt=now["feels_like"].."°C"})

out({c=0x48D1CC,a=1,f="mono",fs=12,x=20,y=140,txt="Wetter: "})
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=70,y=140,txt=conditions_short[1]})

out({c=0x48D1CC,a=1,f="mono",fs=12,x=20,y=120,txt="Wind: "})
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=70,y=120,txt=p2c(now["wind_km"])..", "..now["wind_nesw"]})


--[[
local x = now["wind_km"]
if(x == 0 and x == 1.85) then
  print "windstill"
elseif (x == 1.85 and x < 9.0) then
  print "geringer Wind"
elseif (x > 9.0 and x < 19.0) then
  print "leichter Wind"
elseif (x > 19.0 and x < 28.0) then
  print "schwacher Wind"
elseif (x > 28.0 and x < 37.0) then
  print "mäßiger Wind"
elseif (x > 37.0 and x < 46.0) then
  print "frischer Wind"
elseif (x > 46.0 and x < 56.0) then
  print "starker Wind"
elseif (x > 56.0 and x < 65.0) then
  print "starker bis stürmischer Wind"
elseif (x > 65.0 and x < 74.0) then
  print "stürmischer Wind"
elseif (x > 74.0 and x < 83.0) then
  print "Sturm"
elseif (x > 83.0 and x < 102.0) then
  print "schwerer Sturm"
elseif (x > 102.0 and x < 120.0) then
  print "Orkanartiger Sturm"
else
  print "?"
end


if speed>x and speed<y then
return beaufont number
else if speed>a and speed<b then
etc
]]--


--start or weather forecast table section
--set start forecast day
start_day=1
--set total forecast days you want to display
-- x left & right
-- y up & down
number_of_days=5
topy=180
topyy=70 -- topy+(topyy*1)
topx=20
topxx=130
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]        =topx ,topy
   top_left_x_coordinate[2],top_left_y_coordinate[2]     =topx ,topy+(topyy*1)
top_left_x_coordinate[3],top_left_y_coordinate[3]        =topx ,topy+(topyy*2)
   top_left_x_coordinate[4],top_left_y_coordinate[4]     =topx ,topy+(topyy*3)
top_left_x_coordinate[5],top_left_y_coordinate[5]        =topx ,topy+(topyy*4)
   top_left_x_coordinate[6],top_left_y_coordinate[6]     =topx ,topy+(topyy*5)
top_left_x_coordinate[7],top_left_y_coordinate[7]        =topx ,topy+(topyy*6)
   top_left_x_coordinate[8],top_left_y_coordinate[8]     =topx ,topy+(topyy*7)
top_left_x_coordinate[9],top_left_y_coordinate[9]        =topx ,topy+(topyy*8)
   top_left_x_coordinate[10],top_left_y_coordinate[10]   =topx ,topy+(topyy*9)
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do --start of day repeat, do not edit #######
tlx=top_left_x_coordinate[i] --sets top left x position for each repeat ##################
tly=top_left_y_coordinate[i] --sets top left y position for each repeat ##################
--########################################################################################
out({c=0xA4FFA4,a=0.9,f="Anonymous Pro:bold",fs=11,x=tlx,y=tly,txt=forecast_day_short[i]..", "..forecast_date[i]..". "..forecast_month_short[i].." "..now["year"]})

out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=10,x=tlx,y=tly+14,txt="S: "..sun_rise_24[i]})
   out({c=0xdfd7d7,a=0.8,f="Anonymous Pro:bold",fs=10,x=tlx+60,y=tly+13,txt=sun_set_24[i].." Uhr"})
out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=10,x=tlx,y=tly+30,txt="M: "..moon_rise_24[i]})
   out({c=0xdfd7d7,a=0.8,f="Anonymous Pro:bold",fs=10,x=tlx+60,y=tly+30,txt=moon_set_24[i].." Uhr"})
out({c=0xdfd7d7,a=0.9,f="Anonymous Pro:bold",fs=10,x=tlx,y=tly+45,txt="P: "..moon_phase[i]})

--    image({x=tlx+130,y=tly,w=40,h=40,file=moon_icon[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
--suchen des dezimalpunktes und ersetzen mit komma
function p2c(num)
local a,b=string.gsub(tostring(num),"%.",",")
return a
end

and here my conky-config:

# — Conky settings — #
background yes
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 1440
imlib_cache_size 0

# — Window specifications — #

own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 300 550
maximum_width 300

alignment tl
gap_x 50
gap_y 10

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

# — Text settings — #
use_xft yes
#xftfont Zarautz special:size=24
xftalpha 0.7
xftfont mono:size=9

uppercase no

default_color d2c8c8

lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
#lua_load ~/v9000/weather_testing.lua
lua_load ~/v9000/template.lua


TEXT

@sector11

an other update-intervall in the conky-file? an hour is a good idea.

it would be nice to have 'international icons'.

Last edited by lionhead (2012-03-11 16:16:31)


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#660 2012-03-09 19:01:31

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

mrpeachy wrote:
Sector11 wrote:

Should we incorporate them?

once you get done i can add the folder to the main archive

Easier: I'll create the images with the same numbers as seen in my previous post, 08.png, 10.png, 23.png & 24.png as seen above, and add only those to a separate folder, /s11_weathericon_options.  If people want them they just copy them over to the /weathericons folder.  Cuts down on the size of the download but gives the options to use the new ones.  Just have a few more to look at....

Offline

#661 2012-03-09 19:02:46

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

i thnk i have the answer !
you have these lines in your current conditions section

image({x=20,y=10,h=80,w=80,file=now["weather_icon"]})

out({c=0xA4FFA4,a=1,f="mono",fs=15,x=140,y=40,txt=now["temp"].."°C"})
out({c=0x48D1CC,a=1,f="mono",fs=15,x=140,y=70,txt=now["feels_like"].."°C"})

out({c=0x48D1CC,a=1,f="mono",fs=12,x=20,y=140,txt="Wetter: "})
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=70,y=140,txt=conditions_short[1]})

out({c=0x48D1CC,a=1,f="mono",fs=12,x=20,y=120,txt="Wind: "})
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=70,y=120,txt=p2c(now["wind_km"])..", "..now["wind_nesw"]})

your getting the current icon now["weather_icon"]
BUT your matching it with the forecast conditions
conditions_short[1]

needs to be

now["conditions_short"]

Last edited by mrpeachy (2012-03-09 19:03:48)

Offline

#662 2012-03-09 19:43:38

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

this was the cause of the error. until the next error wink

i think that it's easier to use a word instead of a number smile

this function is based on the beaufort-scale: http://en.wikipedia.org/wiki/Beaufort_scale

thanks to mrpeachy for basic concept of this function

function wind_speed_text(input)
--only get the numbers
local x=string.find(input,"(%d*).*")
if x < 1.85  then
wind_text = "windstill"
elseif x >= 1.85 and x < 9.0 then
wind_text = "geringer Wind"
elseif x >= 9.0 and x < 19.0 then
wind_text = "leichter Wind"
elseif x >= 19.0 and x < 28.0 then
wind_text = "schwacher Wind"
elseif x >= 28.0 and x < 37.0 then
wind_text = "mäßiger Wind"
elseif x >= 37.0 and x < 46.0 then
wind_text = "frischer Wind"
elseif x >= 46.0 and x < 56.0 then
wind_text = "starker Wind"
elseif x >= 56.0 and x < 65.0 then
wind_text = "starker bis stürmischer Wind"
elseif x >= 65.0 and x < 74.0 then
wind_text = "stürmischer Wind"
elseif x >= 74.0 and x < 83.0 then
wind_text = "Sturm"
elseif x >= 83.0 and x < 102.0 then
wind_text = "schwerer Sturm"
elseif x >= 102.0 and x < 120.0 then
wind_text = "orkanartiker Sturm"
elseif x >= 120.0 and x < 194.0 then
wind_text = "Sturm"
end--of if x = section
return wind_text
end--of function wind_speed_text

i've place the function at the end of my template.

this is the output in the template: out({txt=wind_speed_text(now["wind_km"])})

but it doesn't work right sad it shows the wrong wind condition.

here is my question to all of the lua-experts: why does the function do not work???


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#663 2012-03-09 19:48:44

kri5
#! Die Hard
From: L.G.C. UK
Registered: 2011-11-10
Posts: 568

Re: weather in conky (LUA scripts)

Sector11 wrote:

kri5 wrote:

    Just decided to take a dive off the deep end and have a go myself.  I'm using the 'weather_script.lua' config and everything appears to be running fine so far but i have just one question.  What is the number in the very top right corner?

{sounds of unoiled hinges on a door opening on a dark eerie night}
Welcome, we've been waiting for you.

mrpeachy tossed in a ${cpu} in there when he wrote it to see how much cpu resources the script uses.

Right after TEXT in the conky: ~/v9000/conky_weather

TEXT
${goto 230}${cpu}

Take it out if you don't want it BUT:
WARNING: Leave a blank empty line after text!  To run "any" lua script it requires at least one line after text - used, as seen above - or blank.  But it must be there.

Thanks Sector11, have removed that now, also removed the alert icon as it did not go with my colour scheme.  May remove the entire alert section, as i don't imagine i'll be getting that many here in the UK. lol


#! Waldorf - 64bit - Xfce

Offline

#664 2012-03-09 20:42:31

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

@ lionhead

here is the problem

local x=string.find(input,"(%d*).*")

the string.find operation can return multiple values

so it needs to be

local a,b,x=string.find(input,"(%d*).*")

in this case
a will be the character number where the match starts
b will be where the match ends
and
EDIT
x will be the captured output

got it right in the code, just slipped up here smile

Last edited by mrpeachy (2012-03-09 21:02:13)

Offline

#665 2012-03-09 20:57:51

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

c is the captured output? but i do not use c in the function?!

function wind_speed_text(input)
--only get the numbers
local a,b,x=string.find(input,"(%d*).*")
if x < 1.85  then
wind_text = "windstill"
elseif x >= 1.85 and x < 9.0 then
wind_text = "geringer Wind"
elseif x >= 9.0 and x < 19.0 then
wind_text = "leichter Wind"
elseif x >= 19.0 and x < 28.0 then
wind_text = "schwacher Wind"
elseif x >= 28.0 and x < 37.0 then
wind_text = "mäßiger Wind"
elseif x >= 37.0 and x < 46.0 then
wind_text = "frischer Wind"
elseif x >= 46.0 and x < 56.0 then
wind_text = "starker Wind"
elseif x >= 56.0 and x < 65.0 then
wind_text = "starker bis stürmischer Wind"
elseif x >= 65.0 and x < 74.0 then
wind_text = "stürmischer Wind"
elseif x >= 74.0 and x < 83.0 then
wind_text = "Sturm"
elseif x >= 83.0 and x < 102.0 then
wind_text = "schwerer Sturm"
elseif x >= 102.0 and x < 120.0 then
wind_text = "orkanartiker Sturm"
elseif x >= 120.0 and x < 194.0 then
wind_text = "Sturm"
end--of if x = section
return wind_text
end--of function wind_speed_text

and this is my call in the template:
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=75,y=120,txt=wind_speed_text(now["wind_km"])..", "..p2c(now["wind_km"])})

the function does not work sad do i have to initialize the variables a, b and c?

btw: what is the output of the 'alert-status'? a number or is it also a string?


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#666 2012-03-09 21:02:38

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

see edited post above!

Offline

#667 2012-03-09 21:19:53

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

it doesn't work:
http://ompldr.org/vY3poeg/2012-03-09-22 … _scrot.png

the function is located at the end of my template:

--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbanglinux.org/forums/topic/16100/weather-in-conky/

 the file:
http://dl.dropbox.com/u/19008369/v9000.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbanglinux.org/forums/topic/17246/how-to-using-lua-scripts-in-conky/
]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="Anonymous Pro"--font must be in quotes
default_font_size=11
default_color=0xffffff--white
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE

image({x=20,y=10,h=80,w=80,file=now["weather_icon"]})

out({c=0xA4FFA4,a=1,f="mono",fs=15,x=140,y=40,txt=now["temp"].."°C"})
out({c=0x48D1CC,a=1,f="mono",fs=15,x=140,y=70,txt=now["feels_like"].."°C"})

out({c=0x48D1CC,a=1,f="mono",fs=12,x=20,y=120,txt="Wind: "})
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=75,y=120,txt=wind_speed_text(now["wind_km"])})

out({c=0x48D1CC,a=1,f="mono",fs=12,x=20,y=140,txt="Wetter: "})
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=75,y=140,txt=now["conditions_short"]})




--[[
out({c=0xdfd7d7,a=1,f="mono",fs=12,x=70,y=120,txt=wind_speed_text(now["wind_km"])..","..p2c(now["wind_km"])..", "..now["wind_nesw"]})
]]--

--start or weather forecast table section
--set start forecast day
start_day=1
--set total forecast days you want to display
-- x left & right
-- y up & down
number_of_days=5
topy=180
topyy=70 -- topy+(topyy*1)
topx=20
topxx=130
--set coordinates for top lef corners for each repeat
top_left_x_coordinate[1],top_left_y_coordinate[1]        =topx ,topy
   top_left_x_coordinate[2],top_left_y_coordinate[2]     =topx ,topy+(topyy*1)
top_left_x_coordinate[3],top_left_y_coordinate[3]        =topx ,topy+(topyy*2)
   top_left_x_coordinate[4],top_left_y_coordinate[4]     =topx ,topy+(topyy*3)
top_left_x_coordinate[5],top_left_y_coordinate[5]        =topx ,topy+(topyy*4)
   top_left_x_coordinate[6],top_left_y_coordinate[6]     =topx ,topy+(topyy*5)
top_left_x_coordinate[7],top_left_y_coordinate[7]        =topx ,topy+(topyy*6)
   top_left_x_coordinate[8],top_left_y_coordinate[8]     =topx ,topy+(topyy*7)
top_left_x_coordinate[9],top_left_y_coordinate[9]        =topx ,topy+(topyy*8)
   top_left_x_coordinate[10],top_left_y_coordinate[10]   =topx ,topy+(topyy*9)
--########################################################################################
for i=start_day,number_of_days-(start_day-1) do --start of day repeat, do not edit #######
tlx=top_left_x_coordinate[i] --sets top left x position for each repeat ##################
tly=top_left_y_coordinate[i] --sets top left y position for each repeat ##################
--########################################################################################
out({c=0xA4FFA4,a=0.9,f="Anonymous Pro:bold",fs=11,x=tlx,y=tly,txt=forecast_day_short[i]..", "..forecast_date[i]..". "..forecast_month_short[i].." "..now["year"]})

out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=10,x=tlx,y=tly+14,txt="S: "..sun_rise_24[i]})
   out({c=0xdfd7d7,a=0.8,f="Anonymous Pro:bold",fs=10,x=tlx+60,y=tly+13,txt=sun_set_24[i].." Uhr"})
out({c=0x48D1CC,a=1,f="Anonymous Pro:bold",fs=10,x=tlx,y=tly+30,txt="M: "..moon_rise_24[i]})
   out({c=0xdfd7d7,a=0.8,f="Anonymous Pro:bold",fs=10,x=tlx+60,y=tly+30,txt=moon_set_24[i].." Uhr"})
out({c=0xdfd7d7,a=0.9,f="Anonymous Pro:bold",fs=10,x=tlx,y=tly+45,txt="P: "..moon_phase[i]})

--    image({x=tlx+130,y=tly,w=40,h=40,file=moon_icon[i]})
--########################################################################################
end--of forecast repeat section ##########################################################
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
--suchen des dezimalpunktes und ersetzen mit komma
function p2c(num)
local a,b=string.gsub(tostring(num),"%.",",")
return a
end

function wind_speed_text(input)
--only get the numbers
local a,b,x=string.find(input,"(%d*).*")
if x < 1.85  then
wind_text = "windstill"
elseif x >= 1.85 and x < 9.0 then
wind_text = "geringer Wind"
elseif x >= 9.0 and x < 19.0 then
wind_text = "leichter Wind"
elseif x >= 19.0 and x < 28.0 then
wind_text = "schwacher Wind"
elseif x >= 28.0 and x < 37.0 then
wind_text = "mäßiger Wind"
elseif x >= 37.0 and x < 46.0 then
wind_text = "frischer Wind"
elseif x >= 46.0 and x < 56.0 then
wind_text = "starker Wind"
elseif x >= 56.0 and x < 65.0 then
wind_text = "starker bis stürmischer Wind"
elseif x >= 65.0 and x < 74.0 then
wind_text = "stürmischer Wind"
elseif x >= 74.0 and x < 83.0 then
wind_text = "Sturm"
elseif x >= 83.0 and x < 102.0 then
wind_text = "schwerer Sturm"
elseif x >= 102.0 and x < 120.0 then
wind_text = "orkanartiker Sturm"
elseif x >= 120.0 and x < 194.0 then
wind_text = "Sturm"
end--of if x = section
return wind_text
end--of function wind_speed_text

Last edited by lionhead (2012-03-09 21:39:30)


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#668 2012-03-09 22:42:59

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

@lionhead

try this

function wind_speed_text(input)
--only get the numbers
local a,b,x=string.find(input,"(%d*).*")

local x=tonumber(x)--tonumber to make sure x is a number

if x < 1.85  then

Offline

#669 2012-03-09 22:53:06

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

kri5 wrote:

Thanks Sector11, have removed that now, also removed the alert icon as it did not go with my colour scheme.  May remove the entire alert section, as i don't imagine i'll be getting that many here in the UK. lol

No problem, I turned Alerts 'off' with the on/off switch, I doubt I'll get any here either.

in the ~/.v9000_config.lua file:

-- set 1 if you want to translate, 0 if not.
-- the translation tables are located below
local translate=1
-- set alerts on or off, set to 0 so that the script does not check for alerts
-- set 1 to check for alerts
local alert_check=0

... it was easier.  big_smile

Offline

#670 2012-03-10 10:10:09

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

@mrpeachy

this was the solution. it works now smile
here is an example: http://ompldr.org/vY3pucw/2012-03-10-11 … _scrot.png

it was the problem that the variable x was still a string. but now it's a number.
i'm so stupid because i had this problem before sad but it looks now better. it's now easier to imagine then the simble number for the wind speed. but i still have the number in brackets. now i can test the function smile

you said once that's really windy at your place? can u please test the function? because some of the 'wind conditions' only happen sometimes (in different seasons/years). i could also translate the table! what do u think?

do u have a solution for this problem yet: Light Rain/Wind
i still think that it's just a windy light rain. and we should call it light rain. because it's always a bit windy when it rains! wink
in my opinion it's just an addition (or just another word) to the 'main' weather condition light rain.

i've updated the german translation table because i've found a better translation for 'broken clouds'.
the german translation table seems to be a work in process. sometimes it's hard to translate the english words.

EDIT:

here is a new weathercondition for the german translation table: ["Sprinkles"]="Sprühregen",
i'Ve also updated the post (see above).

Last edited by lionhead (2012-03-10 14:21:47)


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#671 2012-03-10 17:34:04

ackernan
#! Junkie
Registered: 2011-01-10
Posts: 403

Re: weather in conky (LUA scripts)

It's weird that the script shows a partly cloudy image with 60% precip, but a few days later show thunder clouds and only 30% precip.  I thought something was messed up with the script but the intellicast.com website shows that too.  It's not a problem, just interesting.

Offline

#672 2012-03-10 17:42:37

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 2,741

Re: weather in conky (LUA scripts)

@lionhead
thanks for the translations, ive updated the languages folder

still thinking about the /wind thing smile

Offline

#673 2012-03-10 18:15:16

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 298

Re: weather in conky (LUA scripts)

it seems that there is no image for the weather condition 'Sprinkles'.

this is the neccesary image:
http://images.intellicast.com/App_Image … wx_103.png

Last edited by lionhead (2012-03-10 18:16:55)


“If you wish to make an apple pie from scratch, you must first invent the universe.”  Carl Sagan

GET V9000 ( german translationtable) | My Blog

Offline

#674 2012-03-11 10:33:19

kri5
#! Die Hard
From: L.G.C. UK
Registered: 2011-11-10
Posts: 568

Re: weather in conky (LUA scripts)

Sector11 wrote:

No problem, I turned Alerts 'off' with the on/off switch, I doubt I'll get any here either.

in the ~/.v9000_config.lua file:


-- set 1 if you want to translate, 0 if not.
-- the translation tables are located below
local translate=1
-- set alerts on or off, set to 0 so that the script does not check for alerts
-- set 1 to check for alerts
local alert_check=0... it was easier.

Thank's, that does indeed seem more sensible then deleting the section and probably something else by mistake. lol


#! Waldorf - 64bit - Xfce

Offline

Help fund CrunchBang, donate to the project!

#675 2012-03-11 13:43:28

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 7,426
Website

Re: weather in conky (LUA scripts)

kri5 wrote:

Sector11 wrote:

No problem, I turned Alerts 'off' with the on/off switch, I doubt I'll get any here either.

in the ~/.v9000_config.lua file:


-- set 1 if you want to translate, 0 if not.
-- the translation tables are located below
local translate=1
-- set alerts on or off, set to 0 so that the script does not check for alerts
-- set 1 to check for alerts
local alert_check=0... it was easier.

Thank's, that does indeed seem more sensible then deleting the section and probably something else by mistake. lol

Sometimes - on very rare occasions
When the moon is in the Seventh House
And Jupiter aligns with Mars
I have been known to have a good idea!

The rest of the time, it's look out this 'might not work as advertised'  lol

Offline

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