You are not logged in.
That file didn't have the "new" config file ... copy this code to:
~/.v9000_config.lua
--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=F&location=USMO9688"--insert unit=C& after aspx? for C
--set location of weather images (replace "benjamin" with your own username)
local weathericons="/home/benjamin/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",
["Wind Early"]="Wnd AM",
["Snow Showers"]="Sn Shws",
["Thunderstorm"]="T.Strm",--remember to put a comma at the end of every entry
["Scattered"]="Scat",
["Few Snow Showers"]="Fw Sn Shws",
["Wind"]="Wnd",
["Showers"]="Shws",
}--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=" kmh"
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=0
--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=1
--#######################################################################
--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="t_S", -- NOTE: t_ is for testing purposes
SSW="t_SSW",
SW="t_SW",
WSW="t_WSW",
W="t_W",
WNW="t_WNW",
NW="t_NW",
NNW="t_NNW",
N="t_N",
NNE="t_NNE",
NE="t_NE",
ENE="t_ENE",
E="t_E",
ESE="t_ESE",
SE="t_SE",
SSE="t_SSE",
}--end of N E S W text table
--translate time suffix
tsuffix={
AM="t_AM",
PM="t_PM",
}--end of time suffix table
--enter translations for uv index text
uvindextext={
["Low"]="t_Low",
["Moderate"]="t_Moderate",
["High"]="t_High",
["Very High"]="t_Very High",--format is different because of the space in the text
["Extreme"]="t_Extreme",
}--end of uv text table
--enter translations for moonpahse
moonphases={
["New"]="t_New",
["Full"]="t_Full",
["First Quarter"]="t_First Quarter",
["Last Quarter"]="t_Last Quarter",
["Waning Gibbous"]="t_Waning Gibbous",
["Waning Crescent"]="t_Waning Crescent",
["Waxing Crescent"]="t_Waxing Crescent",
["Waxing Gibbous"]="t_Waxing Gibbous",
}--end of moon phase table
--enter translations for FULL day names
daynames={
Monday="t_Monday",
Tuesday="t_Tuesday",
Wednesday="t_Wednesday",
Thursday="t_Thursday",
Friday="t_Friday",
Saturday="t_Saturday",
Sunday="t_Sunday",
}--end day names table
--enter translations for SHORT day names
dayshort={
Monday="t_Mon",
Tuesday="t_Tue",
Wednesday="t_Wed",
Thursday="t_Thu",
Friday="t_Fri",
Saturday="t_Sat",
Sunday="t_Sun"
}--end short day names table
--enter translation for FULL month names
monthnames={
January="t_January",
February="t_February",
March="t_March",
April="t_April",
May="t_May",
June="t_June",
July="t_July",
August="t_August",
September="t_September",
October="t_October",
November="t_November",
December="t_December"
}--end of month name translations
--enter translations for SHORT month names
monthshort={
January="t_Jan",
February="t_Feb",
March="t_Mar",
April="t_Apr",
May="t_May",
June="t_Jun",
July="t_Jul",
August="t_Aug",
September="t_Sep",
October="t_Oct",
November="t_Nov",
December="t_Dec"
}--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 ########################################
--#######################################################################
Then edit this part:
--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=F&location=USMO9688"--insert unit=C& after aspx? for C
--set location of weather images (replace "benjamin" with your own username)
local weathericons="/home/benjamin/v9000/additional_files/weathericons/"
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
found the problem, the conky_weather file
lua_load ~/.conky/v9000/hourdata_test.lua
replaced by
lua_load ~/.conky/v9000/weather_script.lua
now is fine.
Offline
Yea, that helps! I do stuff like that all the time.
Are you going to show your conky when done?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
sure.
The new problem, when time are ex 21:00hr
Conky: llua_do_call: function conky_weather execution failed: /home/fernando/.conky/v9000/v9000.lua:743: attempt to perform arithmetic on local 's' (a nil value)
fix: i have forget set "local utc="
Last edited by wekers (2015-03-03 01:29:26)
Offline
Good stuff ... keep it coming.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Offline
NICE!
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Hi All ! I feel a little bit of shame... I had a beautifull Mr Peachy code called "weathercirle" which dispayed the weather in a circle but unfortunatly, I'm not able to make it works correctly.
only the top part of the picture.
I don't know if the v9000.lua script still working or if it's work with another ?
weathercirce.lua:
--even more weather by mrpeachy 12/31/11
require 'cairo'
require 'imlib2'
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
function conky_weather()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
if updates>5 then
local home = os.getenv("HOME")
--#########################################################################################################
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
secs=300--set update interval
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location=SZXX0014"--insert unit=C& after? for C
--get web address by going to the intellicast site and entering your location in the box
--for version 3 you must get click on "Extended Forecast" to get the necessary address
--set location of weather images
weathericons="~/v9000/additional_files/weathericons/"
weathericons=string.gsub(weathericons, "~", home)
--set defaults
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
--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP--SETUP
--#########################################################################################################
--############start of timed section#######################################################################
--#########################################################################################################
local updates=tonumber(conky_parse('${updates}'))
local timer=(updates %secs)+1
--#######################################
if timer==secs or updates==6 then--######
--#######################################
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
allweather=f:read("*a")
f:close()
if allweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
allweather=f:read("*a")
f:close()
end
if allweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A565 '10 Day Forecast' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
allweather=f:read("*a")
f:close()
end
allweather=string.gsub(allweather,"[\n\r]","")
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions ' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
nowweather=f:read("*a")
f:close()
if nowweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions ' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
nowweather=f:read("*a")
f:close()
end
if nowweather==nil then
local f=io.popen("curl --max-time 60 '"..web.."' | grep -A120 '>Current Conditions ' | sed 's/%//g'")-- > /home/climatix/v9000/weather.txt")
nowweather=f:read("*a")
f:close()
end
nowweather=string.gsub(nowweather,"[\n\r]","")
if allweather==nil then
allweather=""
nowweather=""
print "error curl operation failed"
end
--intellicast to conky weather icon conversion
wimage={
wx_65="32",
wx_66="30",
wx_67="26",
wx_68="32",
wx_69="28",
wx_70="20",
wx_71="32",
wx_72="21",
wx_73="36",
wx_74="14",
wx_75="28",
wx_76="18",
wx_77="14",
wx_78="23",
wx_79="05",
wx_80="15",
wx_81="15",
wx_82="11",
wx_83="16",
wx_84="00",
wx_85="32",
wx_86="25",
wx_87="09",
wx_88="05",
wx_89="18",
wx_90="18",
wx_91="39",
wx_92="39",
wx_93="39",
wx_94="39",
wx_95="37",
wx_96="37",
wx_97="31",
wx_98="29",
wx_99="27",
wx_100="47",
wx_101="47",
wx_102="33",
wx_103="26",
wx_104="20",
wx_105="45",
wx_106="45",
wx_107="11",
wx_108="46",
wx_109="46",
wx_110="06",
wx_111="18",
wx_112="06",
wx_113="46",
wx_114="46",
wx_115="31",
wx_116="47",
}--end w image table
--convert intellicast icons to weather font
wfont={
wx_65="a",
wx_66="c",
wx_67="f",
wx_68="a",
wx_69="d",
wx_70="0",
wx_71="a",
wx_72="9",
wx_73="5",
wx_74="p",
wx_75="d",
wx_76="w",
wx_77="p",
wx_78="6",
wx_79="x",
wx_80="8",
wx_81="8",
wx_82="h",
wx_83="q",
wx_84="m",
wx_85="a",
wx_86="-",
wx_87="h",
wx_88="x",
wx_89="w",
wx_90="w",
wx_91="g",
wx_92="g",
wx_93="g",
wx_94="g",
wx_95="k",
wx_96="k",
wx_97="A",
wx_98="C",
wx_99="D",
wx_100="K",
wx_101="K",
wx_102="B",
wx_103="f",
wx_104="0",
wx_105="G",
wx_106="G",
wx_107="h",
wx_108="O",
wx_109="O",
wx_110="x",
wx_111="w",
wx_112="x",
wx_113="O",
wx_114="O",
wx_115="A",
wx_116="K",
}--end w font table
--conversion day and month tables
dayshort={Monday="Mon",Tuesday="Tue",Wednesday="Wed",Thursday="Thu",Friday="Fri",Saturday="Sat",Sunday="Sun",x=""}
monthshort={January="Jan",February="Feb",March="Mar",April="Apr",May="May",June="Jun",July="Jul",August="Aug",September="Sep",October="Oct",November="Nov",December="Dec",x=""}
moonfontt={New="=",Full="@",FirstQuarter="G",LastQuarter="T",WaningGibbous="R",WaningCrescent="V",WaxingCrescent="E",WaxingGibbous="I"}
windfontt={S="9",SSW=":",SW=";",WSW="<",W="=",WNW=">",NW="?",NNW="@",N="1",NNE="2",NE="3",ENE="4",E="5",ESE="6",SE="7",SSE="8"}
--setup tables for forecast weather
forecast_day={}
forecast_day_caps={}
forecast_day_lc={}
forecast_day_short={}
forecast_day_short_caps={}
forecast_day_short_lc={}
forecast_month={}
forecast_month_caps={}
forecast_month_lc={}
forecast_month_short={}
forecast_month_short_caps={}
forecast_month_short_lc={}
forecast_date={}
weather_icon={}
weather_font={}
high_temp={}
low_temp={}
conditions={}
conditions_caps={}
conditions_lc={}
sun_rise={}
sun_rise_lc={}
moon_rise={}
moon_rise_lc={}
sun_set={}
sun_set_lc={}
moon_set={}
moon_set_lc={}
humidity={}
precipitation={}
snow={}
cloud_cover={}
moon_phase={}
moon_phase_caps={}
moon_phase_lc={}
moon_font={}
wind_mph={}
wind_km={}
wind_kts={}
wind_direction={}
wind_font={}
wind_deg={}
wind_nesw={}
uv_index_num={}
uv_index_txt={}
uv_index_txt_caps={}
uv_index_txt_lc={}
-----------------
--extract information into tables
local start=0
local f=1
while f~=nil do
--match forecast day name and date
s,f,t=string.find(allweather,"<td colspan=\"2\"><strong>([%a,%s%d]*)</strong></td>",start)
if t~=nil then
--split name from month and date
a,b,day=string.find(t,"(%a*),%s")
a,b,month=string.find(t,",%s(%a*)%s")
a,b,date=string.find(t,"(%d*)$")
--ser day names, regular, caps, lowercase and short
table.insert(forecast_day,day)
table.insert(forecast_day_caps,string.upper(day))
table.insert(forecast_day_lc,string.lower(day))
table.insert(forecast_day_short,dayshort[day])
table.insert(forecast_day_short_caps,string.upper(dayshort[day]))
table.insert(forecast_day_short_lc,string.lower(dayshort[day]))
--set month types
table.insert(forecast_month,month)
table.insert(forecast_month_caps,string.upper(month))
table.insert(forecast_month_lc,string.lower(month))
table.insert(forecast_month_short,monthshort[month])
table.insert(forecast_month_short_caps,string.upper(monthshort[month]))
table.insert(forecast_month_short_lc,string.lower(monthshort[month]))
--set date
table.insert(forecast_date,date)
end
--intellicast weather icon match
s,f,t=string.find(allweather,"40_white/(wx_..).png\"",start)
--convert to conkyweather icon
if t~=nil then
table.insert(weather_icon,weathericons..wimage[t]..".png")
--convert to weather font
table.insert(weather_font,wfont[t])
end
--match conditions
s,f,t=string.find(allweather," /><br />([%a%s/]*)</td>",start)
if t~=nil then
table.insert(conditions,t)
table.insert(conditions_caps,string.upper(t))
table.insert(conditions_lc,string.lower(t))
end
--match high temp
s,f,t=string.find(allweather,"\"Hi\">(%d*)°",start)
table.insert(high_temp,t)
--match low temp
s,f,t=string.find(allweather,"\"Lo\">(%d*)°",start)
table.insert(low_temp,t)
--match sunrise and set-- alt="Sunrise" style="vertical-align:bottom;" /><strong>Rise:</strong> 7:19 AM</td> <td><strong>Set:</strong> 4:54 PM</td>
--match sun rise times
s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
if t~=nil then
table.insert(sun_rise,t)
table.insert(sun_rise_lc,string.lower(t))
end
--match sun set times
s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
table.insert(sun_set,t)
table.insert(sun_set_lc,string.lower(t))
end
--moon rise
s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
table.insert(moon_rise,t)
table.insert(moon_rise_lc,string.lower(t))
end
--moon set
s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
table.insert(moon_set,t)
table.insert(moon_set_lc,string.lower(t))
end
--match uv index
s,f,tuv=string.find(allweather,"UV Index:</strong> (%d%s*%(%a*%)) <br />",start)
if tuv~=nil then
a,b,t=string.find(tuv,"(%d*)%s*%(%a*%)")
table.insert(uv_index_num,t)
a,b,t=string.find(tuv,"%d*%s*%((%a*)%)")
table.insert(uv_index_txt,t)
table.insert(uv_index_txt_caps,string.upper(t))
table.insert(uv_index_txt_lc,string.lower(t))
end
--match humidity
s,f,t=string.find(allweather,"Humidity:</strong> (%d*)<br />",start)
table.insert(humidity,t)
--match ppt
s,f,t=string.find(allweather,"Precipitation:</strong> (%d*)<br />",start)
table.insert(precipitation,t)
--match snow %
s,f,t=string.find(allweather,"Snow Probability:</strong> (%d*)<br />",start)
table.insert(snow,t)
--match cloud coveage
s,f,t=string.find(allweather,"Cloud Coverage:</strong> (%d*)<br />",start)
table.insert(cloud_cover,t)
--match moon phase
s,f,t=string.find(allweather,"Moon Phase:</strong> ([%a%s]*) <br />",start)
--set moon phase text
if t~= nil then
table.insert(moon_phase,t)
table.insert(moon_phase_caps,string.upper(t))
table.insert(moon_phase_lc,string.lower(t))
--set moon phase font
mp=string.gsub(t," ","")
table.insert(moon_font,moonfontt[mp])
end
--match wind speeds
s,f,t=string.find(allweather,"Wind Speed:</strong> (%d*)Mph",start)
table.insert(wind_mph,t)
s,f,t=string.find(allweather,"Mph%s*%((%d*)Km,",start)
table.insert(wind_km,t)
s,f,t=string.find(allweather,"Km,%s*(%d*)Kts%)",start)
table.insert(wind_kts,t)
--match wind direction
s,f,twd=string.find(allweather,"Wind Direction:</strong> ([%d&;%s%(%a%)]*) </div>",start)
if twd~=nil then
a,b,t=string.find(twd,"(%d*)°")
table.insert(wind_deg,t)
--match wind font and nesw
a,b,t=string.find(twd,"%((%a*)%)")
table.insert(wind_font,windfontt[t])
table.insert(wind_nesw,t)
end
if f==nil then break end
start=f
end--while
--#########################################################################################################################################
--end--of timed section
--format now weather
--extract current data
now={}
monthlong={Jan="January",Feb="February",Mar="March",Apr="April",May="May",Jun="June",Jul="July",Aug="August",Sep="September",Oct="October",Nov="November",Dec="December"}
s,f,tnow=string.find(nowweather,"<div style=\"float:right;color:#666;\"> As of ([%d%p%a%s]*) %(Local Time%)")
s,f,t=string.find(tnow,"(%d*%p%d*%s%a*) on")
now["time"]=t
now["time_lc"]=string.lower(t)
s,f,t=string.find(tnow,"on (%a*)%s%d*")
now["day"]=t
now["day_caps"]=string.upper(t)
now["day_lc"]=string.lower(t)
ds=dayshort[t]
now["day_short"]=ds
now["day_short_caps"]=string.upper(ds)
now["day_short_lc"]=string.lower(ds)
s,f,t=string.find(tnow,"%s(%d%d)%s")
now["date"]=t
s,f,t=string.find(tnow,"%d%d%s(%a*)%s%d")
now["month_short"]=t
now["month_short_caps"]=string.upper(t)
now["month_short_lc"]=string.lower(t)
ml=monthlong[t]
now["month"]=ml
now["month_caps"]=string.upper(ml)
now["month_lc"]=string.lower(ml)
s,f,t=string.find(tnow,"%a%a%a%s(%d%d%d%d)")
now["year"]=t
s,f,t=string.find(nowweather,"40_white/(wx_%d%d(%d)).png")
s,f,t=string.find(nowweather,"40_white/(wx_%d*).png")
now["weather_font"]=wfont[t]
s,f,t=string.find(nowweather,"class=\"Icon\" /> (%a*(%s%a*))%s*</td>")
now["conditions"]=t
now["conditions_caps"]=string.upper(t)
now["conditions_lc"]=string.lower(t)
s,f,t=string.find(nowweather,"Temperature\">([%p%d]*)°")
now["temp"]=t
s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)°</a>")
now["feels_like"]=t
s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)°</td>")
now["wind_chill"]=t
s,f,t=string.find(nowweather,">Ceiling: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
s,f,t=string.find(t,"(%d*)")
t=t.." mi"
end
now["ceiling"]=t
now["ceiling_caps"]=string.upper(t)
now["ceiling_lc"]=string.lower(t)
s,f,t=string.find(nowweather,">Heat Index: </a></td>%s*<td>([%p%d]*)°</td>")
now["heat_index"]=t
s,f,t=string.find(nowweather,">Visibility: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
s,f,t=string.find(t,"(%d*)")
t=t.." mi"
end
now["visibility"]=t
now["visibility_caps"]=string.upper(t)
s,f,t=string.find(nowweather,">Dew Point: </a></td>%s*<td>([%p%d]*)°</td>")
now["dew_point"]=t
s,f,t=string.find(nowweather,">Wind: </a></td>%s*<td>(%d*)mph</td>")
now["wind_mph"]=t.." mph"
s,f,t=string.find(nowweather,">Humidity: </a></td>%s*<td>(%d*)</td>")
now["humidity"]=t
s,f,twd=string.find(nowweather,">Direction: </a></td>%s*<td style=[%p%a]*>([%d&;%s%(%a%)]*)</td>%s*</tr>")
a,b,t=string.find(twd,"(%d*)°")
now["wind_deg"]=t
a,b,t=string.find(twd,"%((%a*)%)")
now["wind_nesw"]=t
now["wind_font"]=windfontt[t]
s,f,t=string.find(nowweather,">Pressure: </a></td>%s*<td>([%d%p]*)\"</td>")
now["pressure"]=t
s,f,t=string.find(nowweather,">Gusts: </a></td>%s*<td>([%d%a]*)</td>")
if t~="NA" then
s,f,t=string.find(t,"(%d*)")
t=t.." mph"
end
now["wind_gusts"]=t
now["wind_gusts_caps"]=string.upper(t)
--###############end of data processing########################
--###########################
end--of timed section########
--###########################
--write lines here to show in conky
--these tables hold the top left coordinates for each repeat as set lower, do not edit
top_left_x_coordinate={}
top_left_y_coordinate={}
--write settings, c=color,a=alpha,f=font,fs=font size,x=x position, y=y position, txt=text or data to show
--eg out({c=0xffff00,a=1,f="Sans",fs=14,x=100,y=100,txt="hello world"})
--image settings, x=top left x position, y=top left y position, w=width of image(0=full size), h=height(0=full size),file=file location
--eg image({x=0,y=35,w=60,h=60,file=now[weather_icon]})
--########################################################
--######### write or paste setups below ##################
--########################################################
midx=160
midy=160
radouter=150
radinner=50
radforecast=90
radhilo=125
radfctxt=130
radcond=110
radsmall=25
fcangle1=0
fcangle2=45
fcangle3=90
fcangle4=135
fcangle5=180
wcr,wcg,wcb,wca=1,1,1,0.3
---------------------------------------------
cairo_set_line_width (cr,1)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
--draw outer circle
cairo_arc (cr,midx,midy,radouter,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
--draw inner circle
cairo_arc (cr,midx,midy,radinner,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
--draw forecast line and text
astr=270
aend=350
cairo_arc (cr,midx,midy,radfctxt,(math.pi/180)*(astr-90),(math.pi/180)*(aend-90))
cairo_stroke (cr)
cwt={text="FORECAST ",font="mono",fsize=16,radius=radfctxt+3,xpos=midx,ypos=midy,position=1,start=astr,finish=aend,justify=1,letterdeg=5,};cw(cwt)
--set start and end angle for conditions box
astr=205
aend=335
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
cairo_arc (cr,midx,midy,radcond,(math.pi/180)*(astr-90),(math.pi/180)*(aend-90))
cairo_stroke (cr)
cwt={text="CURRENT CONDITIONS ",font="mono",fsize=14,radius=radcond+3,xpos=midx,ypos=midy,position=1,start=astr,finish=aend,justify=1,letterdeg=5,};cw(cwt)
--print current temps
trad=radcond-16
cwt={text="TMP: "..now["temp"].."F / FL: "..now["feels_like"].."F ",font="mono",fsize=14,radius=trad,xpos=midx,ypos=midy,position=2,start=astr+5,finish=aend-5,justify=1,letterdeg=5.5,};cw(cwt)
--print current conditions wrap to length
--wrap settings
line_text=now["conditions_caps"]
max_string_len=16
indent=""
clines=to_lines(line_text,max_string_len,indent)
--set radius for conditions lines (shouldnt need more than 2)
crad1=trad-16
crad2=crad1-16
cwt={text=clines[1],font="mono",fsize=14,radius=crad1,xpos=midx,ypos=midy,position=2,start=astr+5,finish=aend-10,justify=1,letterdeg=7,};cw(cwt)
cwt={text=clines[2],font="mono",fsize=14,radius=crad2,xpos=midx,ypos=midy,position=1,start=astr+5,finish=aend-10,justify=1,letterdeg=8,};cw(cwt)
--connect lines to form curent box
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*astr
xs1=0+radcond*(math.sin(arc))
ys1=0-radcond*(math.cos(arc))
arc=(math.pi/180)*astr
xe1=0+radinner*(math.sin(arc))
ye1=0-radinner*(math.cos(arc))
cairo_move_to (cr,midx+xs1,midy+ys1)
cairo_line_to (cr,midx+xe1,midy+ye1)
cairo_stroke (cr)
arc=(math.pi/180)*aend
xs2=0+radcond*(math.sin(arc))
ys2=0-radcond*(math.cos(arc))
arc=(math.pi/180)*aend
xe2=0+radinner*(math.sin(arc))
ye2=0-radinner*(math.cos(arc))
cairo_move_to (cr,midx+xs2,midy+ys2)
cairo_line_to (cr,midx+xe2,midy+ye2)
cairo_stroke (cr)
--individual fc circles and forecast data
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle1
xfc1=0+radforecast*(math.sin(arc))
yfc1=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc1,midy+yfc1,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
radst=14
arc=(math.pi/180)*fcangle1
xfc1hl=0+(radsmall+radst)*(math.sin(arc))
yfc1hl=0-(radsmall+radst)*(math.cos(arc))
out({x=midx+xfc1hl+xfc1,y=midy+yfc1hl+yfc1,txt=forecast_day_short_caps[1]})
out({x=midx+xfc1hl+xfc1,y=midy+yfc1hl+yfc1+12,txt=high_temp[1].."F|"..low_temp[1].."F"})
cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle2
xfc2=0+radforecast*(math.sin(arc))
yfc2=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc2,midy+yfc2,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
arc=(math.pi/180)*fcangle2
xfc2hl=0+(radsmall+radst)*(math.sin(arc))
yfc2hl=0-(radsmall+radst)*(math.cos(arc))
out({x=midx+xfc2hl+xfc2,y=midy+yfc2hl+yfc2,txt=forecast_day_short_caps[2]})
out({x=midx+xfc2hl+xfc2,y=midy+yfc2hl+yfc2+12,txt=high_temp[2].."F|"..low_temp[2].."F"})
cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle3
xfc3=0+radforecast*(math.sin(arc))
yfc3=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc3,midy+yfc3,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
arc=(math.pi/180)*fcangle3
xfc3hl=0+(radsmall+radst)*(math.sin(arc))
yfc3hl=0-(radsmall+radst)*(math.cos(arc))
out({x=midx+xfc3hl+xfc3,y=midy+yfc3hl+yfc3,txt=forecast_day_short_caps[3]})
out({x=midx+xfc3hl+xfc3,y=midy+yfc3hl+yfc3+12,txt=high_temp[3].."F|"..low_temp[3].."F"})
cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle4
xfc4=0+radforecast*(math.sin(arc))
yfc4=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc4,midy+yfc4,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
arc=(math.pi/180)*fcangle4
xfc4hl=0+(radsmall+radst)*(math.sin(arc))
yfc4hl=0-(radsmall+radst)*(math.cos(arc))
out({x=midx+xfc4hl+xfc4,y=midy+yfc4hl+yfc4,txt=forecast_day_short_caps[4]})
out({x=midx+xfc4hl+xfc4,y=midy+yfc4hl+yfc4+12,txt=high_temp[4].."F|"..low_temp[4].."F"})
cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
arc=(math.pi/180)*fcangle5
xfc5=0+radforecast*(math.sin(arc))
yfc5=0-radforecast*(math.cos(arc))
cairo_arc (cr,midx+xfc5,midy+yfc5,radsmall,(math.pi/180)*0,(math.pi/180)*360)
cairo_stroke (cr)
arc=(math.pi/180)*fcangle5
xfc5hl=0+(radsmall+radst)*(math.sin(arc))
yfc5hl=0-(radsmall+radst)*(math.cos(arc))
out({x=midx+xfc5hl+xfc5,y=midy+yfc5hl+yfc5,txt=forecast_day_short_caps[5]})
out({x=midx+xfc5hl+xfc5,y=midy+yfc5hl+yfc5+12,txt=high_temp[5].."F|"..low_temp[5].."F"})
cairo_stroke (cr)
cairo_set_source_rgba (cr,wcr,wcg,wcb,wca)
--show weather icons
imsizel=80
image({x=midx-imsizel,y=midy-imsizel,w=imsizel,h=imsizel,file=now["weather_icon"]})
imsizes=50
image({x=midx+xfc1-imsizes,y=midy+yfc1-imsizes,w=imsizes,h=imsizes,file=weather_icon[1]})
image({x=midx+xfc2-imsizes,y=midy+yfc2-imsizes,w=imsizes,h=imsizes,file=weather_icon[2]})
image({x=midx+xfc3-imsizes,y=midy+yfc3-imsizes,w=imsizes,h=imsizes,file=weather_icon[3]})
image({x=midx+xfc4-imsizes,y=midy+yfc4-imsizes,w=imsizes,h=imsizes,file=weather_icon[4]})
image({x=midx+xfc5-imsizes,y=midy+yfc5-imsizes,w=imsizes,h=imsizes,file=weather_icon[5]})
--#########################################################
--########## end of current conditions ####################
--######### forecast weather and repeat ###################
--#########################################################
--enter number of forecast days to show
number_of_days=8
--enter coordinates of top left corner for each day
top_left_x_coordinate[1],top_left_y_coordinate[1]=270,15
top_left_x_coordinate[2],top_left_y_coordinate[2]=540,15
top_left_x_coordinate[3],top_left_y_coordinate[3]=0,190
top_left_x_coordinate[4],top_left_y_coordinate[4]=270,190
top_left_x_coordinate[5],top_left_y_coordinate[5]=540,190
top_left_x_coordinate[6],top_left_y_coordinate[6]=0,370
top_left_x_coordinate[7],top_left_y_coordinate[7]=270,370
top_left_x_coordinate[8],top_left_y_coordinate[8]=540,370
------------------------
for i=1,number_of_days do--start of day repeat, do not edit
tlx=top_left_x_coordinate[i]--sets top left position for each repeat
tly=top_left_y_coordinate[i]--sets top left position for each repeat
--write day format below, write x and y relative to top left coordinates as in the example
--write i to call day as this will be replaced with the day number for each repeat
end--of day repeat, do not edit
--##############################################################
--############## end of weather display setup ##################
--##############################################################
end-- if updates>5
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
function out(tx)
color=nil
color=tx.c
if color==nil then color=default_color end
alpha=nil
alpha=tx.a
if alpha==nil then alpha=default_alpha end
font=nil
font=tx.f
if font==nil then font=default_font end
fsize=nil
fsize=tx.fs
if fsize==nil then fsize=default_font_size end
xpos=nil
xpos=tx.x
if xpos==nil then xpos=0 end
ypos=nil
ypos=tx.y
if ypos==nil then ypos=0 end
text=nil
text=tx.txt
if text==nil then text="hello world" end
local function col(c)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,alpha
end--local function
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,col(color))
cairo_move_to (cr,xpos,ypos)
cairo_show_text (cr,text)
cairo_stroke (cr)
end--function out
function image(im)
x=nil
x=im.x
if x==nil then x=0 end
y=nil
y=im.y
if y==nil then y=0 end
w=nil
w=im.w
if w==nil then w=default_image_width end
h=nil
h=im.h
if h==nil then h=default_image_height end
file=nil
file=tostring(im.file)
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then
width=imlib_image_get_width()
else
width=tonumber(w)
end
if tonumber(h)==0 then
height=imlib_image_get_height()
else
height=tonumber(h)
end
local iacross=x+(width/2)
local idown=y+(height/2)
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(iacross, idown)
imlib_free_image()
show=nil
end--function image
function cw(t)
--set variables and defualts
if t.text==nil then text="" else text=t.text end
if t.font==nil then font="mono" else font=t.font end
if t.fsize==nil then fsize=12 else fsize=t.fsize end
if t.radius==nil then radius=50 else radius=t.radius end
if t.xpos==nil then xpos=100 else xpos=t.xpos end
if t.ypos==nil then ypos=100 else ypos=t.ypos end
if t.position==nil then position=1 else position=t.position end
if t.start==nil then start=270 else start=t.start end
if t.finish==nil then finish=90 else finish=t.finish end
if t.justify==nil then justify=1 else justify=t.justify end
if t.letterdeg==nil then letterdeg=5 else letterdeg=t.letterdeg end
--end variables
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,1,1,1,1);
if finish<start then finish=finish+360 end
local inum=string.len(text)
---------------------------
if position==1 then
deg=(finish-start)/(inum-1)
elseif position==2 then
deg=letterdeg
if justify==1 then
start=start
elseif justify==2 then
start=start-((letterdeg*inum)/2)
elseif justify==3 then
start=start-(letterdeg*inum)
end
end
----------------------------
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1|")
texttable=string.split(textcut, "|")
for i=1,inum do
interval=(degrads*(start+(deg*(i-1))))
txs=0+radius*(math.sin(interval))
tys=0-radius*(math.cos(interval))
cairo_move_to (cr, txs+xpos, tys+ypos);
cairo_rotate (cr, interval)
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -interval)
end
end--circlewriting
function cwd(t)
--set variables and defualts
if t.text==nil then text="" else text=t.text end
if t.font==nil then font="mono" else font=t.font end
if t.fsize==nil then fsize=12 else fsize=t.fsize end
if t.radius==nil then radius=50 else radius=t.radius end
if t.xpos==nil then xpos=100 else xpos=t.xpos end
if t.ypos==nil then ypos=100 else ypos=t.ypos end
if t.position==nil then position=1 else position=t.position end
if t.start==nil then start=270 else start=t.start end
if t.finish==nil then finish=90 else finish=t.finish end
if t.justify==nil then justify=1 else justify=t.justify end
if t.letterdeg==nil then letterdeg=5 else letterdeg=t.letterdeg end
--end variables
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fsize)
cairo_set_source_rgba (cr,1,1,1,1);
if start<finish then start=start+360 end
local inum=string.len(text)
---------------------------
if position==1 then
deg=(start-finish)/(inum-1)
elseif position==2 then
deg=letterdeg
if justify==1 then
start=start
elseif justify==2 then
start=start+((letterdeg*inum)/2)
elseif justify==3 then
start=start+(letterdeg*inum)
end
end
----------------------------
local degrads=(math.pi/180)
local textcut=string.gsub(text, ".", "%1<>")
texttable=string.split(textcut, "<>")
for i=1,inum do
interval=(degrads*(start-(deg*(i-1))))
txs=0+radius*(math.sin(interval))
tys=0-radius*(math.cos(interval))
cairo_move_to (cr, txs+xpos, tys+ypos);
cairo_rotate (cr, interval+(math.pi))
cairo_show_text (cr, (texttable[i]))
cairo_stroke (cr)
cairo_rotate (cr, -1*(interval+(math.pi)))
end
end--cwd
function to_lines(line_text,max_string_len,indent)
---------------------------------------------
--set defaults for function
local default_max_length=50
local default indent=""
---------------------------------------------
if indent==nil then indent=default_indent end
if max_string_len==nil then max_string_len=default_max_length end
local i=1
text_table={line_text}
while text_table[i]~=nil do
if max_string==nil then max_string=max_string_len end
local v=text_table[i]
if string.len(v)>max_string_len and string.find(v," ")~=nil and string.find(string.sub(v,1,max_string)," ")~=nil then
long=string.len(v)
splitcha=string.sub(v,max_string,max_string)
if splitcha~=" " then
while splitcha~=" " do
if max_string>1 then
max_string=max_string-1
splitcha=string.sub(v,max_string,max_string)
else
splitcha=" "
end
end
end
local insertit=tostring(indent..string.sub(v,max_string+1,long))
table.insert(text_table,i+1,insertit)
text_table[i]=tostring(string.sub(v,1,max_string-1))
elseif string.len(v)>max_string_len and string.find(v," ")~=nil and string.find(string.sub(v,1,max_string)," ")==nil then
long=string.len(v)
splitcha=string.sub(v,max_string,max_string)
while splitcha~=" " do
if max_string<long then
max_string=max_string+1
splitcha=string.sub(v,max_string,max_string)
else
splitcha=" "
end
end
local insertit=tostring(indent..string.sub(v,max_string+1,long))
table.insert(text_table,i+1,insertit)
text_table[i]=tostring(string.sub(v,1,max_string-1))
end
i=i+1
max_string=max_string_len
end
return text_table
end--function
conky:
### Begin Window Settings ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override #override
own_window_transparent yes
own_window_hints below,sticky,skip_taskbar,skip_pager
own_window_argb_visual no
#own_window_colour black
own_window_class Forecast Conky
own_window_title Forecast by MrP
# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes
### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### 'own_window_type override'
own_window_argb_visual no
### When ARGB visuals are enabled, this use this to modify the alpha value
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
#own_window_argb_value 0
minimum_size 450 450 ## width, height
maximum_width 450 450 ## width, usually a good idea to equal minimum width
gap_x 10 ### left &right
gap_y 10 ### up & down
alignment tl
#################################################### End Window Settings ###
### Font Settings ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
# xftfont Anonymous Pro:bold:size=9
# xftfont Unispace:size=8
# xftfont Onuava:size=8
#xftfont Inconsolata:bold:size=10
# xftfont Andale Mono:bold:size=9
xftfont DejVu Mono:size=9
# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 0
# Force UTF8? requires XFT ###
override_utf8_locale yes
draw_shades no
default_shade_color black
draw_outline no # amplifies text if yes
default_outline_color black
uppercase no
###################################################### End Font Settings ###
### Color Settings #########################################################
default_shade_color grey
default_outline_color black
default_color DCDCDC #Gainsboro
color0 DAA520 #Goldenrod FFFFF0 #Ivory
color1 778899 #LightSlateGrey
color2 FF8C00 #Darkorange
color3 7FFF00 #Chartreuse
color4 FFA07A #LightSalmon
color5 FFDEAD #NavajoWhite
color6 00BFFF #DeepSkyBlue
color7 00FFFF #Cyan 48D1CC #MediumTurquoise
color8 FFFF00 #Yellow
color9 FF0000 #Red
##################################################### End Color Settings ###
### Borders Section ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 10
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders no
##################################################### End Borders Secton ###
### Miscellaneous Section ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background no
# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are using a mono font
# Options: right, left or none
use_spacer none
# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
text_buffer_size 256
# Subtract (file system) buffers from used memory?
no_buffers yes
# change GiB to G and MiB to M
short_units yes
# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2
############################################## End Miscellaneous Section ###
### LUA Settings ###########################################################
lua_load ~/v9000/weathercircle.lua
lua_draw_hook_pre weather #starts the lua weather data gathering function, call once at top of conkyrc
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1
top_name_width 7
TEXT
If someone can test it thanks
Offline
I don't know if the v9000.lua script still working or if it's work with another ?
If someone can test it thanks
Hello my friend ...
v9000 stopped working and was updated by destripato (new file), change the approperate lines:
--************************FILL ONLY THESE FIELDS BELOW!*********************************************
local utc= 0
local maxHours=3 --(you can type here from 3 to 42. Adjust it to your needs (hourly weather))
local username = os.getenv("USERNAME")
--you can enter your username here in case of errors,
--enter username in quotes like this username = "yourname"
local username = username
package.path = '/home/'..username..'/.v9000_config.lua'
--**************************************************************************************************
and "v9000" will work.
Ran this just now: - and weathercircle:
However, there is a problem with the weathercircle.lua - line 508
Conky: llua_do_call: function conky_weather execution failed: /home/sector11/v9000/weathercircle.lua:508: attempt to concatenate field '?' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: /home/sector11/v9000/weathercircle.lua:508: attempt to concatenate field '?' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: /home/sector11/v9000/weathercircle.lua:508: attempt to concatenate field '?' (a nil value)
Conky: llua_do_call: function conky_weather execution failed: /home/sector11/v9000/weathercircle.lua:508: attempt to concatenate field '?' (a nil value)
LUA is not my strength as you know. But this new v9000.lua file will get weather ... I used this 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 #######################################################
--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"]})
image({x=20,y=20,h=40,w=40,file=now["wind_icon"]})
-- Temp / FeelsLike & CONDITIONS TEXT
out({c=0x48D1CC,a=1,f="digitalk",fs=50,x=80,y=60,txt=now["temp"]})
out({c=0x00BFFF,a=1,f="digitalk",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"]})
-- 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_lc[1]})
out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*8),txt=sun_set_lc[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_lc[1]})
out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*9),txt=moon_set_lc[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]})
-- 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"].." "..now["fc_hour1_ampm"]})
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"].." "..now["fc_hour2_ampm"]})
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"].." "..now["fc_hour3_ampm"]})
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=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_lc[i]})
out({c=0x48D1CC,a=1,x=tlx+73,y=tly+95,txt=sun_set_lc[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+110,txt="M: "..moon_rise_lc[i]})
out({c=0x48D1CC,a=1,x=tlx+73,y=tly+110,txt=moon_set_lc[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 ##################
--#######################################################################
This will get you going in the right direction. I wish you luck.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
@Sector11 thanks for your answer I'll check it this evening.
Offline
Please let me know the results.
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
nop
I changed the 'username' field but always
raphix@moonstone:~$ conky -c /home/raphix/v9000/conky_weather
Conky: llua_load: /home/raphix/v9000/v9000.lua:22: attempt to concatenate local 'username' (a nil value)
Conky: desktop window (2d8) is root window
Conky: window type - normal
Conky: drawing to created window (0x3800002)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!
raphix@moonstone:~$ conky -c /home/raphix/v9000/conky_weather
Conky: llua_load: /home/raphix/v9000/v9000.lua:22: attempt to call global 'raphix' (a nil value)
Conky: desktop window (2d8) is root window
Conky: window type - normal
Conky: drawing to created window (0x1400002)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!
raphix@moonstone:~$ conky -c /home/raphix/v9000/conky_weather
Conky: desktop window (2d8) is root window
Conky: window type - normal
Conky: drawing to created window (0x1400002)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_weather_settings execution failed: attempt to call a nil value
Conky: received SIGINT or SIGTERM to terminate. bye!
raphix@moonstone:~$
Offline
OK - try these as a test, changing username, /path, and such as required:
From the OP:
NOTE: if you already have v9000 setup and are looking to fix the current script, to get the update to work you need the new v9000.lua AND the new .v9000_config.lua.
~/.v9000_config.lua
change if needed:
weathericons ="/home/sector11/v9000/additional_files/weathericons/",
--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)]]
general_settings={--opens settings table, all lines within table must end with a comma
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
location ="ARBA0009",
units ="C",--set "F" or "C"
tries=3,--this is the number of attempts the script will make with curl to download the data
--set location of weather images (replace "benjamin" with your own username)
weathericons ="/home/sector11/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"] ="AM Cloud/PM Sun", --remember the comma at the end of every entry
["AM Rain/Snow Showers"] ="AM Rain/Snow",
["AM Showers"] ="AM Showers",
["AM Snow Showers/Wind"] ="AM Sno Shws/Wind",
["PM Thunderstorms"] ="PM T-storms",
["Broken Clouds"] ="Broken Clouds",
["Few Clouds"] ="Few Clouds",
["Few Snow Showers"] ="Few Snow Showers",
["Isolated Thunderstorms"] ="Iso T-storms",
["Light Rain Late"] ="Light Rain Late",
["Light Rain/Wind"] ="Light Rain/Wind",
["Moderate Fog"] ="Moderate Fog",
["Mostly Cloudy"] ="Mostly Cloudy",
["Mostly Sunny"] ="Mostly Sunny",
["Partly Cloudy"] ="Partly Cloudy",
["Rain/Snow Showers"] ="Rain/Snow Shws",
["Scattered Thunderstorms"] ="Scat T-storms",
["Scattered Clouds"] ="Scat Clouds",
["Scattered Showers"] ="Scat Showers",
["Snow Showers Late"] ="Snow Showers PM",
["Snow Showers"] ="Snow Showers",
["Clear"] ="Clear",
["Cloudy"] ="Cloudy",
["Haze"] ="Haze",
["Overcast"] ="Overcast",
--["Scattered"]="Scat",
["Showers"] ="Showers",
["Sunny"] ="Sunny",
["Thunderstorm"] ="Thunderstorm",
["Wind Early"] ="Wind Early",
["Wind"] ="Wind", --remember the comma at the end of every entry
},--this bracket closes the conditions table
--the script is capable of converting between several unit types
--set how many decimal places you want the conversions to show
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
visibility_unit =" mi",
wind_mph_unit =" mph",
wind_km_unit =" kmh",
wind_kts_unit =" kts",
ceiling_unit =" ft",
wind_degrees_unit ="°",
--set alerts on or off, set to 0 so that the script does not check for alerts
--set 1 to check for alerts
alert_check=0,
--collect hourly data
gethour=1,--or 0 to not gather hourly data
}--closes general_settings table, do not edit
--END OF GENERAL SETTINGS
--#######################################################################
--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
translate=1 --this settings is outside the tables
--TRANSLATION TABLES, activate by setting translate=1 above
--use con_short table above to translate weather conditions
--edit units settings above to complete translation
translation_tables={--opens table, do not edit
--translate NESW text
neswtext={--opens table, no comma here
S ="S", --S ="t_S",
SSW ="SSW", --SSW ="t_SSW",
SW ="SW", -- above lines show test settings
WSW ="WSW",
W ="W",
WNW ="WNW",
NW ="NW",
NNW ="NNW",
N ="N",
NNE ="NNE",
NE ="NE",
ENE ="ENE",
E ="E",
ESE ="ESE",
SE ="SE",
SSE ="SSE",
},--end of N E S W text table
--translate time suffix
tsuffix={--opens table, no comma here
AM ="AM",
PM ="PM",
},--end of time suffix table
--enter translations for uv index text
uvindextext={--opens table, no comma here
["Low"] ="Low",
["Moderate"] ="Mod",
["High"] ="High",
["Very High"] ="V.High",--format is different because of the space in the text
["Extreme"] ="Extreme",
},--end of uv text table
--enter translations for moonpahse
moonphases={--opens table, no comma here
["New"] ="New Moon",
["Full"] ="Full Moon",
["First Quarter"] ="First Qtr",
["Last Quarter"] ="Last Qtr",
["Waning Gibbous"] ="Waning Gibb",
["Waning Crescent"] ="Waning Cres",
["Waxing Crescent"] ="Waxing Cres",
["Waxing Gibbous"] ="Waxing Gibb",
},--end of moon phase table
--enter translations for FULL day names
daynames={--opens table, no comma here
Monday ="Monday",
Tuesday ="Tuesday",
Wednesday ="Wednesday",
Thursday ="Thursday",
Friday ="Friday",
Saturday ="Saturday",
Sunday ="Sunday",
},--end day names table
--enter translations for SHORT day names
dayshort={--opens table, no comma here
Monday ="Mon",
Tuesday ="Tue",
Wednesday ="Wed",
Thursday ="Thu",
Friday ="Fri",
Saturday ="Sat",
Sunday ="Sun",
},--end short day names table
--enter translation for FULL month names
monthnames={--opens table, no comma here
January ="January",
February ="February",
March ="March",
April ="April",
May ="May",
June ="June",
July ="July",
August ="August",
September ="September",
October ="October",
November ="November",
December ="December",
},--end of month name translations
--enter translations for SHORT month names
monthshort={--opens table, no comma here
January ="Jan",
February ="Feb",
March ="Mar",
April ="Apr",
May ="May",
June ="Jun",
July ="Jul",
August ="Aug",
September ="Sep",
October ="Oct",
November ="Nov",
December ="Dec",
},--end of short month name translations
--enter some additional translations
additional={--opens table, no comma here
NA ="NA",
Unl ="Unl",--for ceiling data option
},--end of additional translations
--END OF TRANSLATION TABLES
}--end of translation tables, do not edit
--#######################################################################
--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==0 then
return general_settings,0,0
elseif translate==1 then
return general_settings,translation_tables,1
end
end--OF SETTINGS AND PREFERENCES ########################################
--#######################################################################
~/v9000/v9000.lua
--weather v9000 by mrpeachy 01/10/12; released: Nov 10, 2014
require 'cairo'
require 'imlib2'
--*******************************************************************
--***Adjust below your TimeZone compared with UTC (Universal Time),
--***visiting for example <http://www.timeanddate.com/worldclock/timezone/utc>
--***Examples:
--***if you live in Los Angeles (California)--> utc= -8
--***if you live in Caracas --> local utc= -4.5
--***if you live in London ---> local utc= 0
--***if you live in Madrid ---> local utc= 1 (important: you never type the sign + here)
--***if you live in New Delhi --> local utc= 5.5 (important: you never type the sign + here)
--***etc...
--**************************************************************************************************
--************************FILL ONLY THESE FIELDS BELOW!*********************************************
local utc= -3
local maxHours=24 --(you can type here from 3 to 42. Adjust it to your needs (hourly weather))
local username = os.getenv("USERNAME")
--you can enter your username here in case of errors,
--enter username in quotes like this username = "yourname"
local username = "sector11"
package.path = '/home/'..username..'/.v9000_config.lua'
--**************************************************************************************************
--**************************************************************************************************
require '.v9000_config'
--INITIALIZE SETTINGS-- need only be run once
get=1
run=1
general_settings,translation_tables,translate=weather_settings()
--GET DAILY WEATHER FUNCTION
function getdaily(l,u)
if u=="F" then
web="http://www.intellicast.com/Local/Forecast.aspx?unit=F&location="..l
elseif u=="C" then
web="http://www.intellicast.com/Local/Forecast.aspx?unit=C&location="..l
end
local f=io.popen("curl --max-time 60 '"..web.."' | sed 's/%//g'")
local allweatherdata=f:read("*a")
f:close()
local allweatherdata=string.gsub(allweatherdata,"[\n\r]","")
if string.find(allweatherdata,">10 Day Forecast ")~=nil then
local a,b,allweather=string.find(allweatherdata,">10 Day Forecast (.*)MarginBottom")
local a,b,nowweather=string.find(allweatherdata,">Current Conditions (.*)>View detailed Observations")
if string.find(allweatherdata,"Severe Weather Alert!")~=nil then
alert=1
else
alert=0
end
--get location
local a,b,wl=string.find(allweatherdata,"<title>%s*Intellicast%s%p%s(.*)</title>")
local weather_location=string.gsub(wl," Extended Forecast in",",")
if string.len(utc)<=2 or utc==-10 or utc==-11 then
a,b,UniTime=string.find(allweatherdata,"Universal Time:</strong> [%a%s%d%p]*, (%d*):%d*%s*</div>")
else
a,b,UniTime=string.find(allweatherdata,"Universal Time:</strong> [%a%s%d%p]*, (%d*:%d*)%s*</div>")
end
return 1,allweather,nowweather,alert,weather_location,UniTime
else
return 0,0,0,0,0,0
end--if testall==1
end--daily
--GET ALERT DATA FUNCTION
function getalert(l)
print ("getting alert data")
local f=io.popen("curl --max-time 60 'http://www.intellicast.com/Storm/Severe/Bulletins.aspx?location="..l.."' | sed 's/%//g'")
local alertdata=f:read("*a")
f:close()
local alertdata=string.gsub(alertdata,"[\n\r]","")
if string.find(alertdata,"%a")~=nil then
return alertdata,1
else
return 0,0
end
end--function alert
--GET HOUR DATA FUNCTION
function gethourdata(l,u)
if u=="F" then
web="http://www.intellicast.com/Local/Hourly.aspx?unit=F&location="..l
elseif u=="C" then
web="http://www.intellicast.com/Local/Hourly.aspx?unit=C&location="..l
end
--get todays hours
local f=io.popen("curl --max-time 60 '"..web.."' | sed 's/%//g'")
local hourlytoday=f:read("*a")
f:close()
local hourlytoday=string.gsub(hourlytoday,"[\n\r]","")
local s,f,day0=string.find(hourlytoday,"Hourly Forecast Report (.*)chartFooter")
--get tomorrows hours
local f=io.popen("curl --max-time 60 '"..web.."&day=Tomorrow' | sed 's/%//g'")
local hourlytomorr=f:read("*a")
f:close()
local hourlytomorr=string.gsub(hourlytomorr,"[\n\r]","")
local s,f,day1=string.find(hourlytomorr,"Hourly Forecast Report (.*)chartFooter")
if maxHours<=24 then
return day0,day1,1
else
--get next day hours
local f=io.popen("curl --max-time 60 '"..web.."&day=Next%20Day' | sed 's/%//g'")
local hournextday=f:read("*a")
f:close()
local hournextday=string.gsub(hournextday,"[\n\r]","")
local s,f,day2=string.find(hournextday,"Hourly Forecast Report (.*)chartFooter")
return day0,day1,day2,1
end
end--hourlydata function
--## MAIN FUNCTION ###########
function conky_weather()--##########
--## SETUP CONKY WINDOW ################################
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))
--###UNCOMMENT THE BELOW LINE TO ENABLE CPU DELAY##########################################################
--if updates>5 then--###### YOU WILL ALSO HAVE TO UNCOMMENT THE MATCHING end ON LINE 923 ####################
--#########################################################################################################
local testing=0--this setting is for script testing, if not in testing set to 0
--#########################################################################################################
if get<4 then--run the script
--############start of timed section#######################################################################
--#########################################################################################################
local timer=(updates %tonumber(general_settings.update_interval))
if timer==0 or run==1 then--######
--##GET DAILY WEATHER DATA#####################################
local location=general_settings.location
local units=general_settings.units or "F"
local tries=general_settings.tries or 3
print ("gathering data with curl. Attempt "..get.." of "..tries)
testall,allweather,nowweather,alert,weather_location,UniTime=getdaily(location,units)
--#######################################
if testall==1 then --curl worked and script should continue
run=nil
continue=1
get=1
elseif testall==0 then
get=get+1
continue=0
run=1
runtemplate=0
end
--##GET ALERT DATA#####################################
alert_check=general_settings.alert_check
if alert_check==1 and alert==1 and continue==1 then --only works if bit before worked, and alerts are on and there are alerts to get
alertdata,alerttest=getalert(location)
--#######################################
if alerttest==1 then --curl worked and script should continue
run=nil
continue=1
get=1
elseif alerttest==0 then
get=get+1
continue=0
run=1
runtemplate=0
end
end--alert section
--##GET HOUR DATA#####################################
if continue==1 then
print ("getting hourly data")
if maxHours<=24 then
day0,day1,htest=gethourdata(location,units)
else
day0,day1,day2,htest=gethourdata(location,units)
end
if htest==1 then --curl worked and script should continue
run=nil
continue=1
get=1
elseif htest==0 then
get=get+1
continue=0
run=1
runtemplate=0
end
end
--#########################################################################
end--of timed data gathering section
--#########################################################################
--START PROCESSING ###########################################################################
if continue==1 then--all instances of curl worked
--START PROCESSING ###########################################################################
local weathericons=general_settings.weathericons
local con_short=general_settings.con_short
local visibility_unit=general_settings.visibility_unit
local wind_mph_unit=general_settings.wind_mph_unit
local wind_km_unit=general_settings.wind_km_unit
local wind_kts_unit=general_settings.wind_kts_unit
local ceiling_unit=general_settings.ceiling_unit
local wind_degrees_unit=general_settings.wind_degrees_unit
--#########################################################################
--LOAD TRANSLATE TABLES IF TRANSLATE SETTING = 1
if translate==1 then
monthshort=translation_tables.monthshort
monthnames=translation_tables.monthnames
dayshort=translation_tables.dayshort
daynames=translation_tables.daynames
neswtext=translation_tables.neswtext
tsuffix=translation_tables.tsuffix
uvindextext=translation_tables.uvindextext
moonphases=translation_tables.moonphases
additional=translation_tables.additional
else--neswtext,tsuffix,uvindextext,moonphases,daynames,dayshort,monthnames,monthshort
dayshort={Monday="Mon",Tuesday="Tue",Wednesday="Wed",Thursday="Thu",Friday="Fri",Saturday="Sat",Sunday="Sun"}
monthshort={January="Jan",February="Feb",March="Mar",April="Apr",May="May",June="Jun",July="Jul",August="Aug",September="Sep",October="Oct",November="Nov",December="Dec"}
end--end if translate =1
--#########################################################################
--process data tables
--intellicast to conky weather icon conversion
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
--convert intellicast icons to weather font
wfont={
wx_65="a",
wx_66="c",
wx_67="f",
wx_68="a",
wx_69="d",
wx_70="0",
wx_71="a",
wx_72="9",
wx_73="5",
wx_74="p",
wx_75="d",
wx_76="w",
wx_77="p",
wx_78="6",
wx_79="x",
wx_80="8",
wx_81="8",
wx_82="h",
wx_83="q",
wx_84="m",
wx_85="a",
wx_86="-",
wx_87="h",
wx_88="x",
wx_89="w",
wx_90="w",
wx_91="g",
wx_92="g",
wx_93="g",
wx_94="g",
wx_95="k",
wx_96="k",
wx_97="A",
wx_98="C",
wx_99="D",
wx_100="K",
wx_101="K",
wx_102="B",
wx_103="f",
wx_104="0",
wx_105="G",
wx_106="G",
wx_107="h",
wx_108="O",
wx_109="O",
wx_110="x",
wx_111="w",
wx_112="x",
wx_113="O",
wx_114="O",
wx_115="A",
wx_116="K",
}--end w font table
--conversion day and month tables
moonfontt={
["New"]="@",
["Full"]="=",
["First Quarter"]="T",
["Last Quarter"]="G",
["Waning Gibbous"]="D",
["Waning Crescent"]="J",
["Waxing Crescent"]="Q",
["Waxing Gibbous"]="W",
}--end of moon font table
moonicont={
["New"]=weathericons.."moon_new.png",
["Full"]=weathericons.."moon_full.png",
["First Quarter"]=weathericons.."moon_first_quarter.png",
["Last Quarter"]=weathericons.."moon_last_quarter.png",
["Waning Gibbous"]=weathericons.."moon_waning_gibbous.png",
["Waning Crescent"]=weathericons.."moon_waning_crescent.png",
["Waxing Crescent"]=weathericons.."moon_waxing_crescent.png",
["Waxing Gibbous"]=weathericons.."moon_waxing_gibbous.png",
}--end of moon icon table
windfontt={
S="9",
SSW=":",
SW=";",
WSW="<",
W="=",
WNW=">",
NW="?",
NNW="@",
N="1",
NNE="2",
NE="3",
ENE="4",
E="5",
ESE="6",
SE="7",
SSE="8"
}--end of wind direction font table
--#########################################################################
--#########################################################################
--setup tables for forecast weather
forecast_day={}
forecast_day_caps={}
forecast_day_lc={}
forecast_day_short={}
forecast_day_short_caps={}
forecast_day_short_lc={}
forecast_month={}
forecast_month_caps={}
forecast_month_lc={}
forecast_month_short={}
forecast_month_short_caps={}
forecast_month_short_lc={}
forecast_date={}
weather_icon={}
weather_font={}
high_temp={}
low_temp={}
conditions={}
conditions_caps={}
conditions_lc={}
conditions_short={}
conditions_short_caps={}
conditions_short_lc={}
sun_rise={}
sun_rise_lc={}
sun_rise_time={}
sun_rise_24={}
moon_rise={}
moon_rise_lc={}
moon_rise_time={}
moon_rise_24={}
moon_rise_ampm={}
moon_rise_ampm_lc={}
sun_set={}
sun_set_lc={}
sun_set_time={}
sun_set_24={}
moon_set={}
moon_set_lc={}
moon_set_time={}
moon_set_24={}
moon_set_ampm={}
moon_set_ampm_lc={}
humidity={}
precipitation={}
snow={}
cloud_cover={}
moon_phase={}
moon_phase_caps={}
moon_phase_lc={}
moon_font={}
moon_icon={}
wind_mph={}
wind_km={}
wind_kts={}
wind_font={}
wind_icon={}
wind_deg={}
wind_nesw={}
uv_index_num={}
uv_index_txt={}
uv_index_txt_caps={}
uv_index_txt_lc={}
--#########################################################################
--## FORECAST WEATHER #######################################################################################################################################
--## FORECAST WEATHER #######################################################################################################################################
--## FORECAST WEATHER #######################################################################################################################################
--## FORECAST WEATHER #######################################################################################################################################
--extract information into tables
local start=0
local f=1
while f~=nil do
--match forecast day name and date
local s,f,t=string.find(allweather,"<td%scolspan=%p2%p><strong>([%a,%s%d]*)</strong></td>",start)
if t~=nil then
--split name from month and date
local a,b,day=string.find(t,"(%a*),%s")
local a,b,month=string.find(t,",%s(%a*)%s")
local a,b,date=string.find(t,"(%d*)$")
--ser day names, regular, caps, lowercase and short
table.insert(forecast_day_short,dayshort[day])
table.insert(forecast_day_short_caps,string.upper(dayshort[day]))
table.insert(forecast_day_short_lc,string.lower(dayshort[day]))
if translate==1 then
day=daynames[day]
else
day=day
end
table.insert(forecast_day,day)
table.insert(forecast_day_caps,string.upper(day))
table.insert(forecast_day_lc,string.lower(day))
--set month types
table.insert(forecast_month_short,monthshort[month])
table.insert(forecast_month_short_caps,string.upper(monthshort[month]))
table.insert(forecast_month_short_lc,string.lower(monthshort[month]))
if translate==1 then
month=monthnames[month]
else
month=month
end
table.insert(forecast_month,month)
table.insert(forecast_month_caps,string.upper(month))
table.insert(forecast_month_lc,string.lower(month))
--set date
table.insert(forecast_date,date)
end--if t~= nil_
--intellicast weather icon match
local s,f,t=string.find(allweather,"40_clear/(wx_[%d]*).png\"",start)
--convert to conkyweather icon
if t~=nil then
table.insert(weather_icon,weathericons..wimage[t]..".png")
--convert to weather font
table.insert(weather_font,wfont[t])
end
--match conditions
local s,f,t=string.find(allweather," /><br />([%a%s%p]*)</td>",start)
if t~=nil then
table.insert(conditions,t)
table.insert(conditions_caps,string.upper(t))
table.insert(conditions_lc,string.lower(t))
--set short versions--------------------------------
local cons=t
for k,v in pairs(con_short) do
if cons==k then
cons=v
end
end
table.insert(conditions_short,cons)
table.insert(conditions_short_caps,string.upper(cons))
table.insert(conditions_short_lc,string.lower(cons))
-----------------------------------------------------
end
--match high temp
local s,f,t=string.find(allweather,"\"Hi\">([%p%d]*)°",start)
table.insert(high_temp,t)
--match low temp
local s,f,t=string.find(allweather,"\"Lo\">([%p%d]*)°",start)
table.insert(low_temp,t)
--match sun rise times
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",start)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
--###############################
--24 hour conversion
table.insert(sun_rise_24,convert24(tm,suf))
--###############################
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(sun_rise,tm.." "..suf)
table.insert(sun_rise_lc,string.lower(tm.." "..suf))
table.insert(sun_rise_time,tm)
end
--match sun set times
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
--###############################
--24 hour conversion
table.insert(sun_set_24,convert24(tm,suf))
--###############################
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(sun_set,tm.." "..suf)
table.insert(sun_set_lc,string.lower(tm.." "..suf))
table.insert(sun_set_time,tm)
end
--moon rise
local s,f,t=string.find(allweather,"Rise:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
--###############################
--24 hour conversion
table.insert(moon_rise_24,convert24(tm,suf))
--###############################
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(moon_rise,tm.." "..suf)
table.insert(moon_rise_lc,string.lower(tm.." "..suf))
table.insert(moon_rise_time,tm)
table.insert(moon_rise_ampm,suf)
table.insert(moon_rise_ampm_lc,string.lower(suf))
end
--moon set
local s,f,t=string.find(allweather,"Set:</strong> (%d*:%d*%s%u%u)</td>",f)
if t~=nil then
--get time only
local a,b,tm=string.find(t,"([%d%p]*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
--###############################
--24 hour conversion
table.insert(moon_set_24,convert24(tm,suf))
--###############################
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
table.insert(moon_set,tm.." "..suf)
table.insert(moon_set_lc,string.lower(tm.." "..suf))
table.insert(moon_set_time,tm)
table.insert(moon_set_ampm,suf)
table.insert(moon_set_ampm_lc,string.lower(suf))
end
--match uv index
local s,f,tuv=string.find(allweather,"UV Index:</strong>%s*(%d*%s*%([%a%s]*%))%s*<br />",start)
if tuv~=nil then
--get just number
local a,b,unm=string.find(tuv,"(%d*)%s*%([%a%s]*%)")
--get just text
local a,b,utx=string.find(tuv,"%d*%s*%(([%a%s]*)%)")
table.insert(uv_index_num,unm)
if translate==1 then
utx=uvindextext[utx]
else
utx=utx
end
table.insert(uv_index_txt,utx)
table.insert(uv_index_txt_caps,string.upper(utx))
table.insert(uv_index_txt_lc,string.lower(utx))
end
--match humidity
local s,f,t=string.find(allweather,"Humidity:</strong> (%d*)<br />",start)
table.insert(humidity,t)
--match ppt
local s,f,t=string.find(allweather,"Precipitation:</strong> (%d*)<br />",start)
table.insert(precipitation,t)
--match snow %
local s,f,t=string.find(allweather,"Snow Probability:</strong>%s*(%d*)<br />",start)
table.insert(snow,t)
--match cloud coveage
local s,f,t=string.find(allweather,"Cloud Coverage:</strong> (%d*)<br />",start)
table.insert(cloud_cover,t)
--match moon phase
local s,f,t=string.find(allweather,"Moon Phase:</strong> ([%a%s]*) <br />",start)
--set moon phase text
if t~= nil then
--set moon phase font and icon
table.insert(moon_font,moonfontt[t])
table.insert(moon_icon,moonicont[t])
if translate==1 then
t=moonphases[t]
else
t=t
end
table.insert(moon_phase,t)
table.insert(moon_phase_caps,string.upper(t))
table.insert(moon_phase_lc,string.lower(t))
end
--match wind speeds
local s,f,tmph=string.find(allweather,"Wind Speed:</strong> (%d*)Mph",start)
local tmph=tonumber(tmph)
table.insert(wind_mph,tmph)
local s,f,t=string.find(allweather,"Mph%s*%((%d*)Km,",start)
table.insert(wind_km,t)
local s,f,t=string.find(allweather,"Km,%s*(%d*)Kts%)",start)
table.insert(wind_kts,t)
--match wind direction
local s,f,twd=string.find(allweather,"Wind Direction:</strong> ([%d&;%s%(%a%)]*)%s*</div>",start)
if twd~=nil then
local a,b,tdeg=string.find(twd,"(%d*)°")
table.insert(wind_deg,tdeg)
--match wind font and nesw
local a,b,tnesw=string.find(twd,"%((%a*)%)")
table.insert(wind_font,windfontt[tnesw])
if tmph>0 and tmph<19 then
table.insert(wind_icon,weathericons.."green_"..string.lower(tnesw)..".png")
elseif tmph>18 and tmph<38 then
table.insert(wind_icon,weathericons.."yellow_"..string.lower(tnesw)..".png")
elseif tmph>37 and tmph<64 then
table.insert(wind_icon,weathericons.."orange_"..string.lower(tnesw)..".png")
elseif tmph>63 then
table.insert(wind_icon,weathericons.."green_"..string.lower(tnesw)..".png")
elseif tmph==0 then
table.insert(wind_icon,weathericons.."no_wind.png")
end
if translate==1 then
tnesw=neswtext[tnesw]
else
tnesw=tnesw
end
table.insert(wind_nesw,tnesw)
end
if f==nil then break end
start=f
end--while
--## ALERTS ###############################################################
--## ALERTS ###############################################################
--## ALERTS ###############################################################
--## ALERTS ###############################################################
if alert_check==1 then
--set tables
alert_type={}
alert_issued={}
if alert==1 then
alert_icon=weathericons.."icon_alert_1.gif"
--extract information into tables
--get alert line
local start=0
local f=1
while f~=nil do
local s,f,t=string.find(alertdata,"><strong class='Alert'>([%a%s]*)</strong><br/>",start)
if t~=nil then
table.insert(alert_type,t)
end--if t~=nil
local s,f,t=string.find(alertdata,"<br />([%d%a%s:]*)<br /><br />",start)
if t~=nil then
table.insert(alert_issued,t)
end--if t~=nil
if f==nil then break end
start=f
alert_number=#alert_type
end--while
else
alert_icon=weathericons.."icon_alert_0.gif"
table.insert(alert_type,"NO ALERTS")
table.insert(alert_issued,"")
alert_number=0
end--alert==1
else
alert_type={}
alert_issued={}
alert_icon=weathericons.."icon_alert_0.gif"
table.insert(alert_type,"alerts turned off")
table.insert(alert_issued,"")
alert_number=0
end--if alert check ###########################################
--#########################################################################
--## HOURLY ###############################################################
--## HOURLY ###############################################################
--## HOURLY ###############################################################
--## HOURLY ###############################################################
--setup tables
forecast_hour={}--number and suffix
forecast_hour_12={}--just number in 12 hour format
forecast_hour_ampm={}--either AM or PM
forecast_hour_24={}--just hour in 24 format
hour_temp={}
hour_windchill={}
hour_heatindex={}
hour_uvindex_num={}
hour_uvindex_txt={}
hour_dewpoint={}
hour_humidity={}
hour_precipitation={}
hour_snow={}
hour_clouds={}
hour_visibility_mi={}
hour_visibility_km={}
hour_wind_nsew={}
hour_wind_mph={}
hour_wind_kmh={}--new variable
hour_weather_icon={}
hour_weather_font={}
hour_conditions={}
hour_conditions_short={}
--NEW CODE
local localtime=">"..fixutc(UniTime,utc).."<"
local webday={day0,day1,day2}
if localtime~=">12 AM<" then
local s,f,htc=string.find(day0,localtime)
web=webday[1]
count=2
initl=s-20
else
local s,f,htc=string.find(day1,localtime)
web=webday[2]
count=3
initl=s-20
end
for i=1,maxHours,1 do
local s,f,time=string.find(web,"DateTime\">(%d*%s%u+)</td>",initl)
table.insert(forecast_hour,time)
local space=string.find(time,"%s")
local num=string.sub(time,1,space-1)
table.insert(forecast_hour_12,num)
local suf=string.sub(time,space+1,string.len(time))
table.insert(forecast_hour_ampm,suf)
table.insert(forecast_hour_24,convert24(num,suf))
local s,f,temp=string.find(web,"<td>([%p%d]*)°%p-</td>",f)
table.insert(hour_temp,temp)
local s,f,chill=string.find(web,"<td>([%p%d]*)°%p-</td>",f)
table.insert(hour_windchill,chill)
local s,f,heat=string.find(web,"<td>([%p%d]*)°%p-</td>",f)
table.insert(hour_heatindex,heat)
local s,f,uvnum=string.find(web,"<td>([%p%d]*)<br",f)
table.insert(hour_uvindex_num,uvnum)
local s,f,uvtxt=string.find(web,"/>([%a%s]*)</td",f)
if translate~=1 then
uvtxt=uvtxt
else
uvtxt=uvindextext[uvtxt]
end
table.insert(hour_uvindex_txt,uvtxt)
local s,f,dew=string.find(web,"<td>([%p%d]*)°%p-</td>",f)
table.insert(hour_dewpoint,dew)
local s,f,hum=string.find(web,"<td>(%d*)</td",f)
table.insert(hour_humidity,hum)
local s,f,ppt=string.find(web,"<td>(%d*)</td",f)
table.insert(hour_precipitation,ppt)
local s,f,snow=string.find(web,"<td>(%d*)</td",f)
table.insert(hour_snow,snow)
local s,f,cloud=string.find(web,"<td>(%d*)</td",f)
table.insert(hour_clouds,cloud)
local s,f,vmi=string.find(web,"<td>(%d*)mi<br",f)
table.insert(hour_visibility_mi,vmi)
local s,f,vkm=string.find(web,"/>(%d*)KM</td",f)
table.insert(hour_visibility_km,vkm)
local s,f,nsew=string.find(web,"<td>(%u*)<br",f)
if nsew~=nil then
if translate~=1 then
nsew=nsew
else
nsew=neswtext[nsew]
end
table.insert(hour_wind_nsew,nsew)
end
local s,f,wmph=string.find(web,"/>(%d*)mph</td",f)
local tosmph=tonumber(wmph)
table.insert(hour_wind_mph,tosmph)
table.insert(hour_wind_kmh,tosmph*1.61)
local s,f,t=string.find(web,"32_clear/(wx_[%d]*).png\"",f)
table.insert(hour_weather_icon,weathericons..wimage[t]..".png")
table.insert(hour_weather_font,wfont[t])
local s,f,cons=string.find(web,"<td>(%a+[%s%a%p]-)</td>",f)
table.insert(hour_conditions,cons)
for k,v in pairs(con_short) do
if cons==k then
cons=v
end
end
table.insert(hour_conditions_short,cons)
initl=f
if forecast_hour[i]~=("11 PM") then
web=web
else
web=webday[count]
count=count+1
initl=0
end
end
--#############################################################
--#########################################################################
--## CURRENT WEATHER #######################################################################################################################################
--## CURRENT WEATHER #######################################################################################################################################
--## CURRENT WEATHER #######################################################################################################################################
--## CURRENT WEATHER #######################################################################################################################################
--format now weather
now={}
monthlong={Jan="January",Feb="February",Mar="March",Apr="April",May="May",Jun="June",Jul="July",Aug="August",Sep="September",Oct="October",Nov="November",Dec="December"}
--<div style="float:right;color:#FFF;">
local s,f,tnow=string.find(nowweather,"As of ([%d%p%a%s]*) %(Local Time%)")
local s,f,t=string.find(tnow,"(%d*%p%d*%s%a*) on")
--get time only
local a,b,ntm=string.find(t,"(%d*%p%d*)")
--get suffix only
local a,b,suf=string.find(t,"(%u%u)")
--###############################
--24 hour conversion
now["time_24"]=convert24(ntm,suf)
--###############################
if translate==1 then
suf=tsuffix[suf]
else
suf=suf
end
now["time"]=ntm.." "..suf
now["time_lc"]=string.lower(ntm.." "..suf)
now["time_num"]=ntm
now["time_ampm"]=suf
now["time_ampm_lc"]=string.lower(suf)
--get day
local s,f,t=string.find(tnow,"on (%a*)%s%d*")
if translate==1 then
day=daynames[t]
else
day=t
end
now["day"]=day
now["day_caps"]=string.upper(day)
now["day_lc"]=string.lower(day)
--short day names
local ds=dayshort[t]
now["day_short"]=ds
now["day_short_caps"]=string.upper(ds)
now["day_short_lc"]=string.lower(ds)
--get date
local s,f,t=string.find(tnow,"%s(%d%d)%s")
now["date"]=t
--get months
local s,f,t=string.find(tnow,"%d%d%s(%a*)%s%d")
if translate==1 then
mnth=monthlong[t]
now["month_short"]=monthshort[mnth]
now["month_short_caps"]=string.upper(monthshort[mnth])
now["month_short_lc"]=string.lower(monthshort[mnth])
mnth=monthnames[mnth]
else
now["month_short"]=t
now["month_short_caps"]=string.upper(t)
now["month_short_lc"]=string.lower(t)
mnth=monthlong[t]
end
now["month"]=mnth
now["month_caps"]=string.upper(mnth)
now["month_lc"]=string.lower(mnth)
--get year
local s,f,t=string.find(tnow,"%a%a%a%s(%d%d%d%d)")
now["year"]=t
--get weather icon
local s,f,t=string.find(nowweather,"40_white/(wx_[%d]*)%ppng%p%stitle=%p")
now["weather_icon"]=weathericons..wimage[t]..".png"
now["weather_font"]=wfont[t]
--class=%pIcon%p /> ([%a%s]*)%s*</td>
local s,f,t=string.find(nowweather,"class=%pIcon%p /> ([%a%s%p]*)%s*%s*</td>%s*<td class=%pEmpty%p> ")
local t=t:gsub("^%s*(.-)%s*$", "%1")
now["conditions"]=t
now["conditions_caps"]=string.upper(t)
now["conditions_lc"]=string.lower(t)
--set short versions------------------------
local cons=t
for k,v in pairs(con_short) do
if cons==k then
cons=v
end
end
now["conditions_short"]=cons
now["conditions_short_caps"]=string.upper(cons)
now["conditions_short_lc"]=string.lower(cons)
--------------------------------------------
local s,f,t=string.find(nowweather,"Temperature\">([%p%d]*)°")
now["temp"]=t
local s,f,t=string.find(nowweather,">Feels Like: ([%p%d]*)°</a>")
now["feels_like"]=t
local s,f,t=string.find(nowweather,">Wind Chill: </a></td>%s*<td>([%p%d]*)°</td>")
now["wind_chill"]=t
local s,f,t=string.find(nowweather,">Ceiling: </a></td>%s*<td>([%a%d]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tc=t..ceiling_unit
else
if translate==1 then unlset=additional.Unl else unlset=t end
tc=unlset
end
now["ceiling"]=tc
now["ceiling_caps"]=string.upper(tc)
now["ceiling_lc"]=string.lower(tc)
--get heat index
local s,f,t=string.find(nowweather,">Heat Index: </a></td>%s*<td>([%p%d]*)°</td>")
now["heat_index"]=t
--get visibility
local s,f,t=string.find(nowweather,">Visibility: </a></td>%s*<td>([%a%d%p]*)</td>")
if t~="Unl" then
local s,f,t=string.find(t,"([%d%p]*)")
tv=t..visibility_unit
else
if translate==1 then unlset=additional.Unl else unlset=t end
tv=unlset
end
now["visibility"]=tv
now["visibility_caps"]=string.upper(tv)
--get dew point
local s,f,t=string.find(nowweather,">Dew Point: </a></td>%s*<td>([%p%d]*)°</td>")
now["dew_point"]=t
--get wind speed
local s,f,t=string.find(nowweather,">Wind: </a></td>%s*<td>(%d*)mph</td>")
local tmph=tonumber(t)
now["wind_mph"]=t..wind_mph_unit
now["wind_mph_caps"]=string.upper(t..wind_mph_unit)
--convert mph to km and knots #################################################
--[[1 mile per hour = 0.869 international nautical mile per hour (knot)
1 mile per hour = 1.609 kilometers per hour
1 mile per hour = 0.4470 meter per second
1 knot = 1.852 kilometers per hour
1 knot = 0.5144 meter per second
1 meter per second = 3.6 kilometers per hour]]
now["wind_km"]=round(tonumber(t)*1.609)..wind_km_unit
now["wind_km_caps"]=string.upper(round(tonumber(t)*1.609)..wind_km_unit)
now["wind_kts"]=round(tonumber(t)*0.869)..wind_kts_unit
now["wind_kts_caps"]=string.upper(round(tonumber(t)*0.869)..wind_kts_unit)
--#############################################################################
local s,f,t=string.find(nowweather,">Humidity: </a></td>%s*<td>(%d*)</td>")
now["humidity"]=t
--get wind direction #######################################################
local s,f,twd=string.find(nowweather,">Direction: </a></td>%s*<td style=[%p%a]*>([%d%p%a%u]*)%s*</td>%s*</tr>")
--check for NA
local a,b,t=string.find(twd,"(%u*)")
local tnesw=t
if tnesw~="NA" then
local a,b,t=string.find(twd,"(%d*)°")
now["wind_deg"]=t..wind_degrees_unit
local a,b,tnesw=string.find(twd,";(%u*)")
if tmph>0 and tmph<19 then
now["wind_icon"]=weathericons.."green_"..string.lower(tnesw)..".png"
elseif tmph>18 and tmph<38 then
now["wind_icon"]=weathericons.."yellow_"..string.lower(tnesw)..".png"
elseif tmph>37 and tmph<64 then
now["wind_icon"]=weathericons.."orange_"..string.lower(tnesw)..".png"
elseif tmph>63 then
now["wind_icon"]=weathericons.."green_"..string.lower(tnesw)..".png"
end
now["wind_font"]=windfontt[tnesw]
--################################
if translate==1 then
tnesw=neswtext[tnesw]
else
tnesw=tnesw
end
--################################
now["wind_nesw"]=tnesw
else
if translate==1 then naset=additional.NA else naset="NA" end
now["wind_deg"]=naset
now["wind_icon"]=weathericons.."no_wind.png"
now["wind_nesw"]=naset
now["wind_font"]=windfontt["N"]
end
--END WIND DIRECTION #######################################################
--get pressure
local s,f,t=string.find(nowweather,">Pressure: </a></td>%s*<td>([%d%p]*)\"</td>")
now["pressure"]=t
--convert pressures ########################################################
--[[ 1 inch of mercury = 25.4 mm of mercury = 33.86 millibars
= 33.86 hectoPascals]]
now["pressure_mb"]=round(tonumber(t)*33.86)
--##########################################################################
local s,f,t=string.find(nowweather,">Gusts: </a></td>%s*<td>([%d%a]*)</td>")
if t~="NA" then
local s,f,t=string.find(t,"(%d*)")
tg=t..wind_mph_unit
tgkm=round(tonumber(t)*1.609)..wind_km_unit
tgkts=round(tonumber(t)*0.869)..wind_kts_unit
else
if translate==1 then naset=additional.NA else naset="NA" end
tg=naset
tgkm=naset
tgkts=naset
end
now["wind_gusts"]=tg
now["wind_gusts_caps"]=string.upper(tg)
now["wind_gusts_km"]=tgkm
now["wind_gusts_km_caps"]=string.upper(tgkm)
now["wind_gusts_kts"]=tgkts
now["wind_gusts_kts_caps"]=string.upper(tgkts)
--##########################################################################
--##########################################################################
--DEPRECATED CODE -- ONLY FOR MAINTENANCE
--get hourly forecast options hour1--------------------
now["fc_hour1_time_24"]=forecast_hour_24[1]
now["fc_hour1_time"]=forecast_hour[1]
now["fc_hour1_ampm"]=forecast_hour_ampm[1]
now["fc_hour1_ampm_lc"]=string.lower(forecast_hour_ampm[1])
now["fc_hour1_cond"]=hour_conditions[1]
now["fc_hour1_cond_lc"]=string.lower(hour_conditions[1])
now["fc_hour1_cond_caps"]=string.upper(hour_conditions[1])
now["fc_hour1_cond_short"]=hour_conditions_short[1]
now["fc_hour1_cond_short_caps"]=string.upper(hour_conditions_short[1])
now["fc_hour1_cond_short_lc"]=string.lower(hour_conditions_short[1])
now["fc_hour1_wicon"]=hour_weather_icon[1]
now["fc_hour1_wfont"]=hour_weather_font[1]
now["fc_hour1_temp"]=hour_temp[1]
--end of hour1 data gathering--repeat 2 more times
--get hourly forecast options hour2--------------------
now["fc_hour2_time_24"]=forecast_hour_24[2]
now["fc_hour2_time"]=forecast_hour[2]
now["fc_hour2_ampm"]=forecast_hour_ampm[2]
now["fc_hour2_ampm_lc"]=string.lower(forecast_hour_ampm[2])
now["fc_hour2_cond"]=hour_conditions[2]
now["fc_hour2_cond_lc"]=string.lower(hour_conditions[2])
now["fc_hour2_cond_caps"]=string.upper(hour_conditions[2])
now["fc_hour2_cond_short"]=hour_conditions_short[2]
now["fc_hour2_cond_short_caps"]=string.upper(hour_conditions_short[2])
now["fc_hour2_cond_short_lc"]=string.lower(hour_conditions_short[2])
now["fc_hour2_wicon"]=hour_weather_icon[2]
now["fc_hour2_wfont"]=hour_weather_font[2]
now["fc_hour2_temp"]=hour_temp[2]
--end of hour2 data gathering--repeat 1 more times
--get hourly forecast options hour3--------------------
now["fc_hour3_time_24"]=forecast_hour_24[3]
now["fc_hour3_time"]=forecast_hour[3]
now["fc_hour3_ampm"]=forecast_hour_ampm[3]
now["fc_hour3_ampm_lc"]=string.lower(forecast_hour_ampm[3])
now["fc_hour3_cond"]=hour_conditions[3]
now["fc_hour3_cond_lc"]=string.lower(hour_conditions[3])
now["fc_hour3_cond_caps"]=string.upper(hour_conditions[3])
now["fc_hour3_cond_short"]=hour_conditions_short[3]
now["fc_hour3_cond_short_caps"]=string.upper(hour_conditions_short[3])
now["fc_hour3_cond_short_lc"]=string.lower(hour_conditions_short[3])
now["fc_hour3_wicon"]=hour_weather_icon[3]
now["fc_hour3_wfont"]=hour_weather_font[3]
now["fc_hour3_temp"]=hour_temp[3]
--end of hour3 data gathering--finished for all hours
--#########################################################################
--###############end of data processing########################
--###############end of data processing########################
--###############end of data processing########################
--###############end of data processing########################
--###############end of data processing########################
--#############################################################
if testing==0 then--script not in testing
continue=0--processing turned off
runtemplate=1--template turned on
print ("processing complete")
elseif testing==1 then
continue=1
runtemplate=1
end--if testing ==0
--##############################################################
end--if continue==1 of data processing section##################
--##############################################################
if runtemplate==1 then
_G.weather_script()
end
--##############################################################
else--if get is greater or equal to 4 then curl did not work
print ("unable to gather data, check connection and try again")
end--if get <4
--###UNCOMMENT THE BELOW LINE TO ENABLE CPU DELAY###############
--end--####### end of if updates>5 #############################
--##############################################################
--clean up
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
--######################################
end-- end main function ################
--######################################
--######################################
--######################################
--######################################
--######################################
--######################################
function round(num)
local idp=tonumber(general_settings.decimal_places)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end--of round function #################################################################
function string:split(delimiter)--######################################################
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end--string split #######################################################################
function xout(txj)--c,a,f,fs,x,y,txt,j ##################################################
c=nil
c=(txj.c or default_color)
a=nil
a=(txj.a or default_alpha)
f=nil
f=(txj.f or default_font)
fs=nil
fs=(txj.fs or default_font_size)
x=nil
x=(txj.x or 0)
y=nil
y=(txj.y or 0)
txt=nil
txt=(txj.txt or "set txt")
j=nil
j=(txj.j or "l")
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, fs)
local text=string.gsub(txt," ","_")
extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local wx=extents.width
cairo_set_source_rgba (cr,col(c,a))
if j=="l" then
cairo_move_to (cr,x,y)
adx=wx
elseif j=="c" then
cairo_move_to (cr,x-(wx/2),y)
adx=wx/2
elseif j=="r" then
cairo_move_to (cr,x-wx,y)
adx=0
end
cairo_show_text (cr,txt)
cairo_stroke (cr)
nextx=nil
nextx=adx+x
return nextx
end--function xout ###################################################################
function out(txj)--c,a,f,fs,face,x,y,txt,hj,vj,ro ##################################################
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
--#########################################################################################################
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
--#########################################################################################################
local c=txj.c or default_color or 0xffffff
local a=txj.a or default_alpha or 1
local f=txj.f or default_font or "mono"
local fs=txj.fs or default_font_size or 12
local x=txj.x or 100
local y=txj.y or 100
local txt=txj.txt or "set txt"
local hj=txj.hj or default_hj or "l"
local vj=txj.vj or default_vj or "n"
local ro=txj.ro or defaukt_ro or 0
local face=txj.face or default_face or "normal"
--set face
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
else
print ('face not set correctly - "normal","bold","italic","bolditalic"')
end
cairo_set_font_size (cr, fs)
cairo_text_extents(cr,txt,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
local tx=x
local ty=y
--set horizontal alignment - l, c, r
if hj=="l" then
x=x-bx
rad=0
elseif hj=="c" then
x=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
x=x-wx
rad=wx-bx
else
print ("hj not set correctly - l, c, r")
end
--vj. n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
y=y
rad2=0
ry=by
elseif vj=="nb" then
y=y-by
rad2=-by
ry=by
elseif vj=="m" then
y=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
y=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
y=y+hy-by
rad2=hy-by
ry=0+by
else
print ("vj not set correctly - n, nb, m, mb, t")
end
--rotation
if ro~=0 then
local point2=(math.pi/180)*(ro-180)
local x2=tx+rad2*(math.sin(point2))
local y2=ty-rad2*(math.cos(point2))
local point=(math.pi/180)*(ro-90)
local x1=x2+rad*(math.sin(point))
local y1=y2-rad*(math.cos(point))
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*ro)
cairo_set_source_rgba (cr,color(c,a))
cairo_show_text (cr,txt)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,x,y)
cairo_set_source_rgba (cr,color(c,a))
cairo_show_text (cr,txt)
cairo_stroke (cr)
end--if ro
end--function out ###################################################################
function image(im)--#################################################################
x=nil
x=(im.x or 0)
y=nil
y=(im.y or 0)
w=nil
w=(im.w or default_image_width)
h=nil
h=(im.h or default_image_height)
file=nil
file=tostring(im.file)
if file==nil then print("set image file") end
---------------------------------------------
local show = imlib_load_image(file)
if show == nil then return end
imlib_context_set_image(show)
if tonumber(w)==0 then
width=imlib_image_get_width()
else
width=tonumber(w)
end
if tonumber(h)==0 then
height=imlib_image_get_height()
else
height=tonumber(h)
end
imlib_context_set_image(show)
local scaled=imlib_create_cropped_scaled_image(0, 0, imlib_image_get_width(), imlib_image_get_height(), width, height)
imlib_free_image()
imlib_context_set_image(scaled)
imlib_render_image_on_drawable(x, y)
imlib_free_image()
show=nil
end--function image ##################################################################
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=tm
tmmn=""
end
if suf=="PM" and tonumber(tmhr)~=12 then
tmhr=tmhr+12
elseif suf=="PM" and tonumber(tmhr)==12 then
tmhr=12
elseif suf=="AM" and tonumber(tmhr)<10 then
tmhr="0"..tmhr
elseif suf=="AM" and tonumber(tmhr)>=10 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
function fixutc(UniTime,utc)
if string.len(UniTime)<=2 then
res=tonumber(UniTime)+utc+1
else
a,b,hours=string.find(UniTime,"(%d*):")
a,b,minutes=string.find(UniTime,":(%d*)")
a,b,utcc=string.find(utc,"(%p*%d*).")
if tonumber(minutes)>=30 and tonumber(utcc)<0 then
res=hours+utcc+1
elseif tonumber(minutes)>=30 and tonumber(utcc)>0 then
res=hours+utcc+2
elseif tonumber(minutes)<=30 and tonumber(utcc)<0 then
res=hours+utcc
elseif tonumber(minutes)<=30 and tonumber(utcc)>0 then
res=hours+utcc+1
end
end
if res>=1 and res<=11 then
res=res
sufi="AM"
elseif res==12 then
res=res
sufi="PM"
elseif res>=13 and res<=23 then
res=res-12
sufi="PM"
elseif res<0 then
res=12+res
sufi="PM"
elseif res==0 or res==24 then
res=12
sufi="AM"
elseif res>=24 then
res=res-24
sufi="AM"
end
return res.." "..sufi
end
--END OF SCRIPT
~/v9000/conky_weather
# pkill -xf "conky -c ~/v9000/conky_weather" &
##############################################
# Settings
##############################################
#max_specials 10000
#max_user_text 1500000
background no
use_xft yes
#xftfont Sans:size=12
#xftalpha 1
font Mono:size=8
total_run_times 0
own_window yes
own_window_argb_visual no # yes
own_window_transparent yes
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 400 400
maximum_width 400
draw_shades yes
draw_outline no
draw_borders no
# Stippled borders?
stippled_borders 5
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 2
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
draw_graph_borders yes
default_color white
default_shade_color black
default_outline_color white
alignment middle_right
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale yes
color1 86acad #darker blue
color2 b1c9c9 #lighter blue
text_buffer_size 100
top_name_width 10
update_interval 1
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
##lua_load ~/v9000/weather_script.lua
lua_load ~/v9000/s11template.lua
TEXT
and: ~/v9000/s11template.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/
]]
_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"]})
image({x=20,y=20,h=40,w=40,file=now["wind_icon"]})
-- Temp / FeelsLike & CONDITIONS TEXT
out({c=0x48D1CC,a=1,f="digitalk",fs=50,x=80,y=60,txt=now["temp"]})
out({c=0x00BFFF,a=1,f="digitalk",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"]})
-- 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_lc[1]})
out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*8),txt=sun_set_lc[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_lc[1]})
out({c=0x48D1CC,a=1,x=120,y=datay+(datayy*9),txt=moon_set_lc[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]})
-- 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"].." "..now["fc_hour1_ampm"]})
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"].." "..now["fc_hour2_ampm"]})
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"].." "..now["fc_hour3_ampm"]})
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=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_lc[i]})
out({c=0x48D1CC,a=1,x=tlx+73,y=tly+95,txt=sun_set_lc[i]})
out({c=0xFAFAEC,a=1,x=tlx,y=tly+110,txt="M: "..moon_rise_lc[i]})
out({c=0x48D1CC,a=1,x=tlx+73,y=tly+110,txt=moon_set_lc[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 ##################
--#######################################################################
In a terminal:
conky -c ~/v9000/conky_weather
Same screenshot as before: http://postimg.org/image/4brn1aatl/
It should work:
27 Sep 15 | 17:47:20 ~/v9000
$ conky -c ~/v9000/conky_weather
Conky: text_buffer_size must be >=256 bytes
Conky: desktop window (265) is root window
Conky: window type - normal
Conky: drawing to created window (0x3a00001)
Conky: drawing to double buffer
gathering data with curl. Attempt 1 of 3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 118k 100 118k 0 0 78653 0 0:00:01 0:00:01 --:--:-- 78627
getting hourly data
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 87595 100 87595 0 0 65956 0 0:00:01 0:00:01 --:--:-- 66009
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 99868 100 99868 0 0 68002 0 0:00:01 0:00:01 --:--:-- 68029
processing complete
You do have "conky_all" installed right?
· ↓ ↓ ↓ ↓ ↓ ↓ ·
BunsenLabs Forums now Open for Registration
· ↑ ↑ ↑ ↑ ↑ ↑ · BL ModSquad
Offline
Yes I have ! Big thanks, I got the datas when I copy and paste your lines codes. Many changes were done since the weather circle was made. I will probably have to do the 'circle graph' by another way than lua and put the new v9000 weather datas inside... The french weather script with accuweather from Didier-T døsn't work anymore with my new distro and repos...
work to do thanks again
regards
raph
Last edited by ragamatrix (2015-09-27 22:03:58)
Offline
8) There are all the functions for drawings circles (weathercircle.lua) in a template, the problem is the syntax, the order and how to call that... 8)
Offline
hi all,
The v9000 worked fine few days and today I have a new lua error :
Conky: llua_do_call: function conky_weather execution failed: /home/raphix/v9000/v9000.lua:742: attempt to perform arithmetic on local 's' (a nil value)
Do you have this problem too ?
I'm working on another display:
8)
Last edited by ragamatrix (2015-10-02 12:02:30)
Offline
I have been away for far too long.. looking good gentleman.
Peachy's Wun Lua / Peachy's v9000 / Conky PitStop / My DA Page
........
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat