SEARCH

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

You are not logged in.

#551 2012-02-29 15:39:44

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,407
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

well, im puzzled!

@sector11, can you try running the new weather_testing.lua template with the new v9000.lua?

once its working, then line 1123 should be this

tmhr=24

change to this

tmhr="00"

so you get,for example, 00:30 instaed of 24:30

Oh for crying out loud and I've been going NUTZ
a5124b177392342.jpg

Even playing with LUA as well:

end--function image ##################################################################
-- Start 24 HR Function ##############################################################
function convert24(tm,suf)
local tmlen=string.len(tm)
local colon=string.find(tm,":")
    if colon~=nil then
    tmhr=string.sub(tm,1,colon-1)
    tmmn=string.sub(tm,colon+1,tmlen)
    else
    tmhr=tmhr
    tmmn=""
    end
-- if suf=="PM" and tonumber(tmhr)~=12 then
-- tmhr="tmhr+12"
-- elseif suf=="PM" and tonumber(tmhr)==12  then
-- tmhr=12

if suf=="PM" and tonumber(tmhr)==12 then tmhr=12
elseif suf=="PM" and tonumber(tmhr)~=12 then tmhr=tmhr+12
elseif suf=="AM" and tonumber(tmhr)<10 then tmhr="0"..tmhr
elseif suf=="AM" and tonumber(tmhr)>9 and tonumber(tmhr)<12 then tmhr=tmhr
elseif suf=="AM" and tonumber(tmhr)==12 then tmhr=00
end
if colon~=nil then
return tmhr..":"..tmmn
else
return tmhr
end--if colon~=nil
end--of function
--END OF SCRIPT

Changing the code to: "am" & "pm"

end--function image ##################################################################
-- Start 24 HR Function ##############################################################
function convert24(tm,suf)
local tmlen=string.len(tm)
local colon=string.find(tm,":")
    if colon~=nil then
    tmhr=string.sub(tm,1,colon-1)
    tmmn=string.sub(tm,colon+1,tmlen)
    else
    tmhr=tmhr
    tmmn=""
    end
-- if suf=="PM" and tonumber(tmhr)~=12 then
-- tmhr="tmhr+12"
-- elseif suf=="PM" and tonumber(tmhr)==12  then
-- tmhr=12

if suf=="pm" and tonumber(tmhr)==12 then tmhr=12
elseif suf=="pm" and tonumber(tmhr)~=12 then tmhr=tmhr+12
elseif suf=="am" and tonumber(tmhr)<10 then tmhr="0"..tmhr
elseif suf=="am" and tonumber(tmhr)>9 and tonumber(tmhr)<12 then tmhr=tmhr
elseif suf=="am" and tonumber(tmhr)==00 then tmhr=00
end
if colon~=nil then
return tmhr..":"..tmmn
else
return tmhr
end--if colon~=nil
end--of function
--END OF SCRIPT

works perfectly ... but your idea of putting it elsewhere for people that do NOT translate "AM"="am" (might be different in various languages) is a must.
5a2550177393892.jpg

Online

Help fund CrunchBang, donate to the project!

#552 2012-02-29 16:16:54

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

Re: weather in conky (LUA scripts) updated 12/26/13!

here is a screenshot from the template:
http://omploader.org/vY3dhbg/2012-02-29 … _scrot.png

the time (up left) works but the times for the sun rise / sun set /moon rise and moon set  are still in 12h format.


here is a new weather condition for the translation table:
["AM Fog/PM Sun"]="vormittags Nebel/nachmittags Sonne",

Last edited by lionhead (2012-02-29 16:24:08)

Offline

#553 2012-02-29 17:03:12

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,407
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

lionhead wrote:

here is a screenshot from the template:
http://omploader.org/vY3dhbg/2012-02-29 … _scrot.png

the time (up left) works but the times for the sun rise / sun set /moon rise and moon set  are still in 12h format.


here is a new weather condition for the translation table:
["AM Fog/PM Sun"]="vormittags Nebel/nachmittags Sonne",

In the ~/v9000_config.lua file look for this line:

--translate time suffix

In mine what follows is:

--translate time suffix
tsuffix={
AM="am",
PM="pm",
}--end of time suffix table

If you changed AM and PM to something other than "AM" and "PM"
you have two oprions:

Change it back to:

--translate time suffix
tsuffix={
AM="AM",
PM="AM",
}--end of time suffix table

Or open v9000.lua and change the bottom part to reflect whatever you have for AM & PM.

Best thing to do for NOW - change the Translation tables in ~/v9000_config.lua back to the origiinal until mrpeachy fixes the v9000 script.  big_smile

Last edited by Sector11 (2012-02-29 17:05:53)

Online

#554 2012-02-29 17:10:07

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

Re: weather in conky (LUA scripts) updated 12/26/13!

this only added another zero! sad

Offline

#555 2012-02-29 17:38:23

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

Re: weather in conky (LUA scripts) updated 12/26/13!

fixed in this archive http://dl.dropbox.com/u/19008369/new%20 … 000.tar.gz
should work no matter what you set in translation because it takes PM or AM from intellicast before its changed

once tested and working, ill change the main link

has anyone noticed if the length matching in the translate function has solved the half translated conditions?

Offline

#556 2012-02-29 18:26:05

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

Re: weather in conky (LUA scripts) updated 12/26/13!

it works now!

but i still test it smile

here is an update for the german translation table: ["Fog Late"]="dichter Nebel",

Last edited by lionhead (2012-02-29 18:31:36)

Offline

#557 2012-02-29 18:44:12

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,407
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

One thing did not work ... but it did work as advertised.

The "3 Hour Forecast" - it is designed to show only the HOUR so in the template I added the 00 minutes:

out({blah blah,txt=now["fc_hour1_time_24"]..":00"})
out({blah blah,txt=now["fc_hour2_time_24"]..":00"})
out({blah blah,txt=now["fc_hour3_time_24"]..":00"})

And now it's doing what it is supposed to do!  This is a combination of Desktop 2 and the right portion of Desktop 3!
bc88c2177424913.jpg

@ mrpeachy put a release date of: Feb 29, 2012 on that sucker and get it up on the first post! lol  Very Very Good stuff!

Online

#558 2012-02-29 18:44:13

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

Re: weather in conky (LUA scripts) updated 12/26/13!

here is a link to .v9000_config.lua files for italian and german
http://dl.dropbox.com/u/19008369/v9000% … ges.tar.gz

these config files contain the same settings, i have just reordered them so that there are general settings first then settings related to translation together

ive been updating the post with intellicast weather types and updating the german config with lionheads translaions

Offline

#559 2012-02-29 18:46:56

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,407
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

here is a link to .v9000_config.lua files for italian and german
http://dl.dropbox.com/u/19008369/v9000% … ges.tar.gz

these config files contain the same settings, i have just reordered them so that there are general settings first then settings related to translation together

ive been updating the post with intellicast weather types and updating the german config with lionheads translaions

HEY!!!!!!!!  Good idea, a few language files for testing...
Now I do Spanish for my wife.

Online

#560 2012-02-29 18:55:09

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:

put a release date of: Feb 29, 2012 on that sucker and get it up on the first post!

done, and updated the data options list

Offline

#561 2012-02-29 19:08:02

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

Re: weather in conky (LUA scripts) updated 12/26/13!

why is the weather conditon still english as standard. but it's translated if u use the preview:
http://omploader.org/vY3didA/2012-02-29 … _scrot.png

Offline

#562 2012-02-29 19:14:31

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

Re: weather in conky (LUA scripts) updated 12/26/13!

lionhead wrote:

why is the weather conditon still english as standard. but it's translated if u use the preview:
http://omploader.org/vY3didA/2012-02-29 … _scrot.png

that because it is still using the regular conditions for current now["conditions"]

not conditions_short, now["conditions_short"]

Offline

#563 2012-02-29 19:32:13

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,407
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:
Sector11 wrote:

put a release date of: Feb 29, 2012 on that sucker and get it up on the first post!

done, and updated the data options list

data options?  What's that?  What did I miss?

Hi lionhead....

Online

#564 2012-02-29 19:43:38

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

Re: weather in conky (LUA scripts) updated 12/26/13!

Sector11 wrote:
mrpeachy wrote:
Sector11 wrote:

put a release date of: Feb 29, 2012 on that sucker and get it up on the first post!

done, and updated the data options list

data options?  What's that?  What did I miss?

Hi lionhead....

nothing missed... just the 24 hour clock options

Offline

#565 2012-02-29 19:46:10

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

Re: weather in conky (LUA scripts) updated 12/26/13!

is it possible to make an other number format just for the translation.

for example: in english u write 1,000.00  and in germany (and other contries) you write 1.000,00

Offline

#566 2012-02-29 19:52:30

Sector11
77345 ¡#
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 13,407
Website

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

nothing missed... just the 24 hour clock options

Oh that - B*E*A*U*T*I*F*U*L Thanks.  big_smile

Online

#567 2012-02-29 20:01:21

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

Re: weather in conky (LUA scripts) updated 12/26/13!

the german translation isn't perfect yet. but i will post 'updates'!

i wait for the russian and the turkish translation! but my translator is a bit slow smile

use this:

["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"]="durchbrochene Bewölkung",
["Few Clouds"]="leichte Bewölkung",
["Few Snow Showers"]="wenig Schneeschauer",
["Isolated Thunderstorms"]="vereinzelt Gewitter",
["Light Rain"]="leichter Regen",
["Light Rain Late"]="leichter Regen nachmittags",
["Light Rain/Wind"]="leichter Regen/windig",
["Fog Late"]="dichter Nebel",
["Moderate Fog"]="mäßig neblig",
["Mostly Cloudy"]="meist bewölkt",
["Mostly Sunny"]="meist sonnig",
["Partly Cloudy"]="teilweise wolkig",
["Partly Cloudy/Wind"]="teilweise wolkig/windig",
["Rain/Snow Showers"]="Regen-/Schneeschauer",
["Scattered Thunderstorms"]="vereinzelt Gewitter",
["Scattered Clouds"]="gering bewölkt",
["Scattered Showers"]="vereinzelt leichter Regen",
["Snow Showers Late"]="Schneeschauer nachmittags",
["Snow Showers"]="Schneeschauer",
["Showers Early"]="leichter Regen",
["Clear"]="klar",
["Cloudy"]="bewölkt",
["Haze"]="neblig",
["Overcast"]="zunehmend bedeckt",
["Showers"]="Schauer",
["Sunny"]="sonnig",
["Thunderstorm"]="Sturm",
["Wind Early"]="leicht windig",
["Wind"]="windig", 

Last edited by lionhead (2012-02-29 20:03:03)

Offline

#568 2012-02-29 20:08:07

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

Re: weather in conky (LUA scripts) updated 12/26/13!

lionhead wrote:

is it possible to make an other number format just for the translation.

for example: in english u write 1,000.00  and in germany (and other contries) you write 1.000,00

i dont think im going to write that into v9000 but you can do it in the template script

if you want to put commas in place of periods

put this function right at the bottom of the template like this

--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
function p2c(num)
local a,b=string.gsub(tostring(num),"%.",",")
return a
end

then use it like this

instead of, for example

out({ x=160,y=ypos,txt=now["pressure_mb"] })

resulting in 1004.7

put this

out({ x=160,y=ypos,txt=p2c(now["pressure_mb"]) })

and you get 1004,7

p2c for period to comma smile

Last edited by mrpeachy (2012-02-29 20:09:02)

Offline

#569 2012-02-29 20:44:45

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

Re: weather in conky (LUA scripts) updated 12/26/13!

hmm, it's not working here:


Conky: llua_do_call: function conky_weather execution failed: /home/alexander/v9000/v9000.lua:981: attempt to call field '?' (a nil value)

Offline

#570 2012-02-29 20:49:13

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

Re: weather in conky (LUA scripts) updated 12/26/13!

lionhead wrote:

hmm, it's not working here:


Conky: llua_do_call: function conky_weather execution failed: /home/alexander/v9000/v9000.lua:981: attempt to call field '?' (a nil value)

post the template script you are using

Offline

#571 2012-02-29 20:51:33

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

Re: weather in conky (LUA scripts) updated 12/26/13!

here is the 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: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 #######################################################
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

--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"].." "..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=conditions_short[1]})

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

image({x=480,y=ypos,w=40,h=40,file=now["wind_icon"]})
image({x=520,y=ypos,w=40,h=40,file=moon_icon[1]})
image({x=420,y=ypos,w=30,h=30,file=alert_icon})

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({ x=160,y=ypos,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="Sonne:"})
   out({c=0xFAFAEC,a=1,x=60,y=datay+(datayy*8),txt=sun_rise_24[1].." Uhr <>"})
   out({c=0x48D1CC,a=1,x=145,y=datay+(datayy*8),txt=sun_set_24[1].." Uhr"})
out({c=0xFAFAEC,a=1,x=10,y=datay+(datayy*9),txt="Mond:"})
   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=55,y=datay+(datayy*10),txt=moon_phase[1]})



--start or weather forecast table section
--set start forecast day
start_day=1
--set total forecast days you want to display
number_of_days=5
topy=15
topyy=135 -- topy+(topyy*1)
topx=285
topxx=137.5
--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 ,150
top_left_x_coordinate[3],top_left_y_coordinate[3]        =10  ,290
   top_left_x_coordinate[4],top_left_y_coordinate[4]     =10+(topxx*1) ,290
top_left_x_coordinate[5],top_left_y_coordinate[5]        =10+(topxx*2)  ,290
--########################################################################################
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,y=tly+95,txt="S: "..sun_rise_24[i]})
   out({c=0x48D1CC,a=1,x=tlx+73,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+73,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 ##################
--#######################################################################

Offline

#572 2012-02-29 20:55:57

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

Re: weather in conky (LUA scripts) updated 12/26/13!

that template doesnt have the p2c function

and re-reading your error message, you put the function into v9000.lua

it goes in the template file and then is called in the template file

like this

--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_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="mono"--font must be in quotes
default_font_size=10
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({ x=160,y=ypos,txt=p2c(now["pressure_mb"]) })

--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################
function p2c(num)
local a,b=string.gsub(tostring(num),"%.",",")
return a
end

Offline

#573 2012-02-29 21:22:45

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

Re: weather in conky (LUA scripts) updated 12/26/13!

@mrpeachy

the script seems to work perfect now. what do u think?

Offline

#574 2012-02-29 21:35:00

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

Re: weather in conky (LUA scripts) updated 12/26/13!

lionhead wrote:

@mrpeachy

the script seems to work perfect now. what do u think?

i think it is done in terms of features

i think perhaps a little more is needed for the translation

its pretty windy here and it seems that EVERY condition is now Condition/Wind
even "Thunderstorms/Wind" ... which is kind of pointless

but that does mean, using the length matching you are going to have a translation of

["Thunderstorms"]="T.Storms"
["Thunderstorms/Wind"]="T.Storms/Wnd"
["Clear"]="Clr"
["Clear/Wind"]="Clr/Wnd"

and so on and so on  while it would be nice to have wind translated only once

["Wind"]="Wnd"
["Partly Cloudy"]="Prt Cldy"

then ignore the "/wind" part of any 2 part conditions, then length match just the first part

so intellicast gives "Partly Cloudy/Wind"

the script recognises the "/Wind" part and changes it to "/Wnd"

THEN it matches "Partly Cloudy" by both length and text and converts to "Prt Cldy"

and combines then to output

Prt Cldy/Wnd

it sounds complicated, but i dont think it would be too much extra code

and would cut down the length of the con_short table considerable
which has the added benefit of making the table matching part quicker
shorter table means less work for the script

BUT

i can also think of some reasons not to do it this way
it leads to an extra level of complexity in making entries into the table
ie more rules to follow when setting it up

Last edited by mrpeachy (2012-02-29 21:44:05)

Offline

Help fund CrunchBang, donate to the project!

#575 2012-02-29 21:41:34

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

Re: weather in conky (LUA scripts) updated 12/26/13!

mrpeachy wrote:

its pretty windy here and it seems that EVERY condition is now Condition/Wind
even "Thunderstorms/Wind" ... which is kind of pointless

indeed,this sounds pointless smile smile

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